-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fc4b13
commit c4a108e
Showing
5 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
using Amazon.Runtime.Endpoints; | ||
using Amazon.Runtime.Internal; | ||
using Amazon.Runtime.Internal.Auth; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace AWSSDK.UnitTests | ||
{ | ||
[TestClass] | ||
public class EndpointsTests | ||
{ | ||
public class TestEndpointProvider : IEndpointProvider | ||
{ | ||
public Endpoint ResolveEndpoint(EndpointParameters parameters) | ||
{ | ||
return new Endpoint("https://localhost:7777"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Endpoints")] | ||
public void EndpointResolverRetainsUriPortNumberWhenHttpIsEnforced() | ||
{ | ||
var config = new MockClientConfig | ||
{ | ||
EndpointProvider = new TestEndpointProvider(), | ||
UseHttp = true | ||
}; | ||
var requestContext = new RequestContext(false, new NullSigner()) | ||
{ | ||
ClientConfig = config, | ||
Request = new DefaultRequest(new MockAmazonWebServiceRequest(), "test-service") | ||
}; | ||
var executionContext = new ExecutionContext(requestContext, null); | ||
var resolver = new BaseEndpointResolver(); | ||
resolver.ProcessRequestHandlers(executionContext); | ||
var endpoint = executionContext.RequestContext.Request.Endpoint; | ||
Assert.AreEqual(7777, endpoint.Port); | ||
Assert.AreEqual("http", endpoint.Scheme); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
sdk/test/UnitTests/Custom/Runtime/MockAmazonWebServiceRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
using Amazon.Runtime; | ||
|
||
namespace AWSSDK.UnitTests | ||
{ | ||
public class MockAmazonWebServiceRequest : AmazonWebServiceRequest | ||
{ | ||
} | ||
} |