public static void Setup(TestContext ctx)
 {
     IntegrationTestManager.Startup(c => {
         ApiVersioning.Configure(c)
         .ConfigureRequestVersionDetector <DefaultRouteKeyVersionDetector>();
     });
 }
        public void HelloApiVersion1_ReturnsExpectedString_WhenInvoked()
        {
            using (HttpClient client = IntegrationTestManager.GetClient()) {
                // arrange
                const string address = "/api/v1/hello";

                // act
                HttpResponseMessage responseMessage = client.GetAsync(address).GetAwaiter().GetResult();
                string result = responseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult();

                // assert
                Assert.AreEqual("\"Version1.0\"", result);
            }
        }
        public void HelloApiVersion3_ReturnsErrorDoesntExist_WhenInvoked()
        {
            using (HttpClient client = IntegrationTestManager.GetClient()) {
                // arrange
                const string address = "/api/v3/hello";

                // act
                HttpResponseMessage responseMessage = client.GetAsync(address).GetAwaiter().GetResult();
                string result = responseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult();

                // assert
                Assert.IsTrue(Regex.IsMatch(result, "The API '([A-z0-9. ]+)' doesn't exist"),
                              "Expected a message like \"The API 'xxx' doesn't exist\"");
            }
        }
 public static void Shutdown()
 {
     IntegrationTestManager.Shutdown();
 }