public async Task StartWithAdminInterfaceAndReadStaticMappingsAndAccessWithBrowser()
 {
     // The collection argument 'urls' must contain at least one element.
     WireMockServer.StartWithAdminInterfaceAndReadStaticMappings("http://localhost:9090");
     // please access http://localhost:9090/__admin/mappings
     this.OpenUrl("http://localhost:9090/__admin/mappings");
     await this.WaitingForResponse();
 }
        public async Task StartWithAdminInterfaceAndReadStaticMappingsAndAccessWithInnerApi()
        {
            // The collection argument 'urls' must contain at least one element.
            var server   = WireMockServer.StartWithAdminInterfaceAndReadStaticMappings("http://localhost");
            var api      = RestClient.For <IWireMockAdminApi>(server.Urls[0]);
            var settings = await api.GetSettingsAsync();

            var mappings = await api.GetMappingsAsync();

            Assert.NotEmpty(mappings);
        }
Example #3
0
        public async Task ScenarioWithJsonTest()
        {
            // Assign
            var server = WireMockServer.StartWithAdminInterfaceAndReadStaticMappings("http://localhost");

            // Act and Assert
            var    client       = new HttpClient();
            string url          = server.Urls[0];
            string getResponse1 = await client.GetStringAsync(url + "/todo/items");

            Assert.Equal("Buy milk", getResponse1);

            var postResponse = await client.PostAsync(url + "/todo/items", new StringContent("Cancel newspaper subscription"));

            Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode);

            string getResponse2 = await client.GetStringAsync(url + "/todo/items");

            Assert.Equal("Buy milk;Cancel newspaper subscription", getResponse2);
        }