示例#1
0
        public void TBefore1Fail()
        {
            var assert1 = new AssertionTest(true, false);
            var assert2 = new AssertionTest(false, false);

            Assert.Throws <SmartTestException>(() => RunTest(AnyValue.IsValid,
                                                             () => Math.Sqrt(0),
                                                             assert1,
                                                             assert2));

            Assert.AreEqual(1, assert2.Before);
            Assert.AreEqual(0, assert1.Before);
            Assert.AreEqual(0, assert1.After);
            Assert.AreEqual(1, assert2.After);
        }
示例#2
0
        public void THappyPath()
        {
            var assert1 = new AssertionTest(false, false);
            var assert2 = new AssertionTest(false, false);

            RunTest(AnyValue.IsValid,
                    () => Math.Sqrt(0),
                    assert1,
                    assert2);

            Assert.AreEqual(1, assert2.Before);
            Assert.AreEqual(1, assert1.Before);
            Assert.AreEqual(1, assert1.After);
            Assert.AreEqual(1, assert2.After);
        }
示例#3
0
        public void Before2Fail()
        {
            var assert1 = new AssertionTest(false, false);
            var assert2 = new AssertionTest(true, false);

            Assert.Throws <SmartTestException>(() => RunTest(AnyValue.IsValid,
                                                             () => DoNothing(),
                                                             assert1,
                                                             assert2));

            Assert.AreEqual(0, assert2.Before);
            Assert.AreEqual(0, assert1.Before);
            Assert.AreEqual(0, assert1.After);
            Assert.AreEqual(0, assert2.After);
        }
示例#4
0
        public void After2Fail()
        {
            var assert1 = new AssertionTest(false, false);
            var assert2 = new AssertionTest(false, true);

            Assert.Throws <NotImplementedException>(() => RunTest(AnyValue.IsValid,
                                                                  () => DoNothing(),
                                                                  assert1,
                                                                  assert2));

            Assert.AreEqual(1, assert2.Before);
            Assert.AreEqual(1, assert1.Before);
            Assert.AreEqual(1, assert1.After);
            Assert.AreEqual(0, assert2.After);
        }
示例#5
0
        public void After2Fail()
        {
            var assert1 = new AssertionTest(false, false);
            var assert2 = new AssertionTest(false, true);

            var exception = Assert.Throws <SmartTestException>(() => RunTest(AnyValue.IsValid,
                                                                             () => DoNothing(),
                                                                             assert1,
                                                                             assert2));

            Assert.AreEqual(typeof(NotImplementedException), exception.InnerException?.GetType());
            Assert.AreEqual(1, assert2.Before);
            Assert.AreEqual(1, assert1.Before);
            Assert.AreEqual(1, assert1.After);
            Assert.AreEqual(0, assert2.After);
        }