コード例 #1
0
        public void ShouldReturnFailedTestWhenWrongMessageIsReturned()
        {
            var tests = PactVerifier.VerifyMessages(_messages, (p) => { }, (d) => new { text = "wrong" });

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("failed", tests.First().Status);
            Assert.AreEqual("A message", tests.First().Description);
        }
コード例 #2
0
        public void ShouldReturnSuccessfulTest()
        {
            var tests = PactVerifier.VerifyMessages(_messages, (p) => { }, (d) => new { text = "test" });

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("passed", tests.First().Status);
            Assert.AreEqual("A message", tests.First().Description);
        }
コード例 #3
0
        public void ShouldReturnFailedTestWhenMessageProducerThrowsPactVerificationException()
        {
            var tests = PactVerifier.VerifyMessages(_messages, (p) => { }, (d) => throw new PactVerificationException("Unknown description."));

            Assert.AreEqual(2, tests.Count);
            Assert.AreEqual("failed", tests.First().Status);
            Assert.AreEqual("A message", tests.First().Description);
            Assert.IsTrue(tests.First().Issues.First().Contains("Unknown description."));
        }
コード例 #4
0
        public void ShouldReturnFailedTestWhenHandlerThrowsPactVerificationException()
        {
            var tests = PactVerifier.VerifyMessages(_messages, (p) => throw new PactVerificationException("Unknown provider state."), (d) => new { text = "test" });

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