예제 #1
0
 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);
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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"));
            }
        }
예제 #4
0
        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"));
            }
        }