コード例 #1
0
        public void TestAssert()
        {
            // Arrange
            var testCase = new TestCase
            {
                Assertions = new AssertionList
                {
                    new StubAssertionBase
                    {
                        Success = true
                    }
                }
            };

            // Act
            testCase.Assert(new Arrange(), new Arrange());

            // Assert
            Assert.IsTrue(testCase.Success);
            Assert.AreEqual(0, testCase.FailedAssertions.Count);
        }
コード例 #2
0
        public void TestAssertWithException()
        {
            // Arrange
            var exception = fixture.Create<Exception>();
            var testCase = new TestCase
            {
                Assertions = new AssertionList
                {
                    new StubAssertionBase
                    {
                        AssertArrangeArrange = (e, a) => { throw exception; }
                    }
                }
            };

            // Act
            testCase.Assert(new Arrange(), new Arrange());

            // Assert
            Assert.IsFalse(testCase.Success);
            Assert.AreEqual(exception, testCase.FailedAssertions[0].Exception);
        }