Example #1
0
        public async Task ShouldReturnFailedTestWhenResponsesDoNotMatch()
        {
            var tests = await PactVerifier.VerifyInteractions(_interactions, (req) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound)), (p) => { });

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("failed", tests.First().Status);
            Assert.AreEqual("An interaction", tests.First().Description);
        }
Example #2
0
        public async Task ShouldReturnSuccessfulTest()
        {
            var tests = await PactVerifier.VerifyInteractions(_interactions, (req) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)), (p) => { });

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("passed", tests.First().Status);
            Assert.AreEqual("An interaction", tests.First().Description);
        }
Example #3
0
        public async Task ShouldReturnFailedTestWhenHandlerThrowsPactVerificationException()
        {
            var tests = await PactVerifier.VerifyInteractions(_interactions, (req) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)),
                                                              (p) => throw new PactVerificationException("Unknown provider state."));

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("failed", tests.First().Status);
            Assert.AreEqual("An interaction", tests.First().Description);
            Assert.IsTrue(tests.First().Issues.First().Contains("Unknown provider state."));
        }