public async void It_can_load_tests_from_a_Peaky_service_by_BaseAddress() { using (var server = new FakeHttpService.FakeHttpService() .WithContentAt("/tests", PeakyResponses.Tests)) { var client = new PeakyClient(server.BaseAddress); var tests = await client.GetTests(); tests.Should().HaveCount(15); } }
public async void When_the_response_contains_no_peaky_tests_Then_it_returns_an_empty_list() { using (var server = new FakeHttpService.FakeHttpService() .WithTestResultAt("/no_test", "hijklmnop", false)) { var client = new PeakyClient(new Uri(server.BaseAddress, @"/tests")); var tests = await client.GetTests(); tests.Should().BeEmpty(); } }
public static IEnumerable <object[]> GetPeakyResults(string serviceUri) { using (var client = new PeakyClient(new Uri(serviceUri))) { foreach (var test in client.GetTests().Result) { var result = client.GetResultFor(test).Result; Console.WriteLine(result.GetType()); yield return(new object[] { test.Application, test.Environment, test.Tags, test.Url, result.Content, result.Passed }); } } }
public async void It_can_load_tests_from_a_Peaky_service_with_specific_environment() { Uri requestUri = null; string requestPath = string.Empty; using (var server = new FakeHttpService.FakeHttpService().OnRequest(r => true).RespondWith(async(response, uri) => { requestUri = uri; requestPath = response.HttpContext.Request.Path.Value; })) { var client = new PeakyClient(new Uri(server.BaseAddress, @"/tests/test")); await client.GetTests(); requestPath.Should().Be(@"/tests/test"); } }
public async void It_retrieves_attributes_from_a_Peaky_service() { using (var server = new FakeHttpService.FakeHttpService() .WithContentAt("/tests", PeakyResponses.Tests)) { var client = new PeakyClient(server.BaseAddress); var tests = await client.GetTests(); var test = tests.First(); test.Application.Should().Be("bing"); test.Environment.Should().Be("prod"); test.Url.Should() .Be("/tests/prod/bing/bing_homepage_returned_in_under_5ms"); test.Tags.Should().BeEquivalentTo("LiveSite", "NonSideEffecting"); } }