Example #1
0
        public void NotThrowWhenAssertingSuccessfulGroup()
        {
            var verifiable = new MockVerifiable();

            verifiable.Verify
            .Return(new[] { new VerificationResult("a passing test", true) });

            var group = new VerificationGroup("My Group")
            {
                verifiable
            };

            group.Assert();
        }
Example #2
0
        public void ThrowWhenAssertingFailedGroup()
        {
            var verifiable = new MockVerifiable();

            verifiable.Verify
            .Return(new[] { new VerificationResult("a failing test", false) });

            var group = new VerificationGroup("My Group")
            {
                verifiable
            };

            var ex = Assert.Throws <VerificationFailedException>(() => group.Assert());

            ex.VerificationResult.AssertEquals(new VerificationResult("Verification Group 'My Group':", new[]
            {
                new VerificationResult("a failing test", false)
            }));

            Assert.Equal(@"Verification failed.

FAILED: Verification Group 'My Group':
FAILED:   a failing test", ex.Message);
        }