public void AzureCustomBaseUriTests() { using (var client = new AutoRestParameterizedHostTestClient(new TokenCredentials(Guid.NewGuid().ToString()))) { // small modification to the "host" portion to include the port and the '.' client.Host = string.Format(CultureInfo.InvariantCulture, "{0}:{1}", client.Host, Fixture.Port); Assert.Equal(HttpStatusCode.OK, client.Paths.GetEmptyWithHttpMessagesAsync("local").Result.Response.StatusCode); } }
public void AzureCustomBaseUriTests() { SwaggerSpecRunner.RunTests( SwaggerPath("custom-baseUrl.json"), ExpectedPath("CustomBaseUri"), generator: "Azure.CSharp"); using (var client = new AutoRestParameterizedHostTestClient(new TokenCredentials(Guid.NewGuid().ToString()))) { // small modification to the "host" portion to include the port and the '.' client.Host = string.Format(CultureInfo.InvariantCulture, "{0}.:{1}", client.Host, Fixture.Port); Assert.Equal(HttpStatusCode.OK, client.Paths.GetEmptyWithHttpMessagesAsync("local").Result.Response.StatusCode); } }
public void AzureCustomBaseUriNegativeTests() { using (var client = new AutoRestParameterizedHostTestClient(new TokenCredentials(Guid.NewGuid().ToString()))) { // use a bad acct name Assert.Throws <HttpRequestException>(() => client.Paths.GetEmpty("bad")); // pass in null Assert.Throws <ValidationException>(() => client.Paths.GetEmpty(null)); // set the global parameter incorrectly client.Host = "badSuffix"; Assert.Throws <HttpRequestException>(() => client.Paths.GetEmpty("local")); } }
public void AzureCustomBaseUriNegativeTests() { SwaggerSpecRunner.RunTests( SwaggerPath("custom-baseUrl.json"), ExpectedPath("CustomBaseUri"), generator: "Azure.CSharp"); using (var client = new AutoRestParameterizedHostTestClient(new TokenCredentials(Guid.NewGuid().ToString()))) { // use a bad acct name Assert.Throws <HttpRequestException>(() => client.Paths.GetEmpty("bad")); // pass in null Assert.Throws <ValidationException>(() => client.Paths.GetEmpty(null)); // set the global parameter incorrectly client.Host = "badSuffix"; Assert.Throws <HttpRequestException>(() => client.Paths.GetEmpty("local")); } }