Пример #1
0
        public async void It_retrieves_results_for_a_failing_test_Url()
        {
            using (var server = new FakeHttpService.FakeHttpService()
                                .WithTestResultAt("/a_failing_test", PeakyResponses.CreateFailedTestResultsFor(new Exception("hijklmnop"), "testApp", "test", "a failing test", "http://server.path/a_failing_test", "a", "b"), false))
            {
                var client = new PeakyClient(new Uri(server.BaseAddress, @"/tests"));

                var test = new Test("", "", new Uri(server.BaseAddress, "/a_failing_test"), null);

                var testResult = await client.GetResultFor(test.Url);

                testResult.Passed.Should().BeFalse();

                testResult.Content.Should().Contain("hijklmnop");
            }
        }
Пример #2
0
        public async void It_retrieves_results_for_a_passing_test()
        {
            using (var server = new FakeHttpService.FakeHttpService()
                                .WithTestResultAt("/a_passing_test", PeakyResponses.CreatePassedTestResultsFor("abcdefg", "testApp", "test", "a passing test", "http://server.path/a_passing_test", "a", "b"), true))
            {
                var client = new PeakyClient(new Uri(server.BaseAddress, @"/tests"));

                var test = new Test("", "", new Uri(server.BaseAddress, "/a_passing_test"), null);

                var testResult = await client.GetResultFor(test);

                testResult.Passed.Should().BeTrue();
                testResult.Test.Application.Should().Be("testApp");
                testResult.Test.Environment.Should().Be("test");
                testResult.Test.Tags.Should().BeEquivalentTo("a", "b");
                testResult.Content.Should().Contain("abcdefg");
            }
        }
Пример #3
0
        public async void It_retrieves_results_for_a_failing_test_Url_and_performs_another_attempt()
        {
            var attempted = false;

            using (var server = new FakeHttpService.FakeHttpService()
                                .WithRetriableTestResultAt(
                       "/a_failing_test", PeakyResponses.CreateFailedRetriableTestResultsFor(new Exception("hijklmnop"), "testApp", "test", "a failing test", "http://server.path/a_failing_test", "a", "b"), false, () => attempted = true))
            {
                var client = new PeakyClient(new Uri(server.BaseAddress, @"/tests"));

                var test = new Test("", "", new Uri(server.BaseAddress, "/a_failing_test"), null);

                var testResult = await client.GetResultFor(test.Url, TimeSpan.Zero);

                attempted.Should().BeTrue();
                testResult.Passed.Should().BeFalse();

                testResult.Content.Should().Contain("hijklmnop");
            }
        }