Example #1
0
        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);
            }
        }
Example #2
0
        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();
            }
        }
Example #3
0
        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 });
                }
            }
        }
Example #4
0
        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");
            }
        }
Example #5
0
        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");
            }
        }