public void Field()
        {
            var mc = new MyClass();

            RunTest(AnyValue.IsValid,
                    Assign(() => mc.MyField, 4),
                    SmartAssert.ChangedTo());
        }
        public void Property()
        {
            var mc = new MyClass();

            RunTest(AnyValue.IsValid,
                    Assign(() => mc.MyProperty, 1),
                    SmartAssert.ChangedTo());
        }
        public void Indexer()
        {
            var mc = new MyClass();

            RunTest(AnyValue.IsValid,
                    Assign(() => mc[0], 1),
                    SmartAssert.ChangedTo());
        }
예제 #4
0
        public void Indirect()
        {
            var mc = new MyClass(false, false, true, false);

            RunTest(AnyValue.IsValid,
                    () => mc.Method(),
                    SmartAssert.ChangedTo(() => mc.Items.Count, 2));
        }
예제 #5
0
        public void BadTestTest()
        {
            InconclusiveExceptionType = typeof(BadTestException);

            RunTest(AnyValue.IsValid,
                    Assign(() => MyClass.Property, 0),
                    SmartAssert.ChangedTo());
        }
예제 #6
0
        public void Indexer()
        {
            var mc = new MyClass(false, true, false, false);

            RunTest(AnyValue.IsValid,
                    () => mc.Method(),
                    SmartAssert.ChangedTo(() => mc[0], 2));
        }
예제 #7
0
        public void InconclusiveTest()
        {
            InconclusiveExceptionType = null; // To be sure to use the default one

            RunTest(AnyValue.IsValid,
                    Assign(() => MyClass.Property, 0),
                    SmartAssert.ChangedTo());
        }
예제 #8
0
        public void Property()
        {
            var mc = new MyClass(true, false, false, false);

            RunTest(AnyValue.IsValid,
                    () => mc.Method(),
                    SmartAssert.ChangedTo(() => mc.MyProperty, 1));
        }
예제 #9
0
        public void Field()
        {
            var mc = new MyClass(false, false, false, true);

            RunTest(AnyValue.IsValid,
                    () => mc.Method(),
                    SmartAssert.ChangedTo(() => mc.MyField, 4));
        }
예제 #10
0
        public void NotChangedExcept()
        {
            var mc = new MyClass();

            RunTest(AnyValue.IsValid,
                    Assign(() => mc.MyProperty1, 1),
                    SmartAssert.NotChangedExceptAct(),
                    SmartAssert.ChangedTo());
        }
예제 #11
0
        public void IndirectBad()
        {
            var exception = Assert.Catch <InconclusiveException>(() =>
            {
                var mc = new MyClass(false, false, true, false);

                RunTest(AnyValue.IsValid,
                        () => mc.Method(),
                        SmartAssert.ChangedTo(() => mc.Items.Count, 1));
            });

            Assert.AreEqual("BAD TEST: unexpected value 1", exception.Message);
        }
예제 #12
0
        public void PropertyBad()
        {
            var exception = Assert.Catch <InconclusiveException>(() =>
            {
                var mc = new MyClass(true, false, false, false);

                RunTest(AnyValue.IsValid,
                        () => mc.Method(),
                        SmartAssert.ChangedTo(() => mc.MyProperty, 0));
            });

            Assert.AreEqual("BAD TEST: unexpected value 0", exception.Message);
        }
예제 #13
0
        public void FieldError()
        {
            var exception = Assert.Catch <SmartTestException>(() =>
            {
                var mc = new MyClass(false, false, false, true);

                RunTest(AnyValue.IsValid,
                        () => mc.Method(),
                        SmartAssert.ChangedTo(() => mc.MyField, 2));
            });

            Assert.AreEqual("Change is wrong. Expected 2, but was 4", exception.Message);
        }
예제 #14
0
        public void IndirectError()
        {
            var exception = Assert.Catch <SmartTestException>(() =>
            {
                var mc = new MyClass(false, false, true, false);

                RunTest(AnyValue.IsValid,
                        () => mc.Method(),
                        SmartAssert.ChangedTo(() => mc.Items.Count, 3));
            });

            Assert.AreEqual("Change is wrong. Expected 3, but was 2", exception.Message);
        }
        public void FieldBad()
        {
            var exception = Assert.Catch <InconclusiveException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        Assign(() => mc.MyField, 0),
                        SmartAssert.ChangedTo());
            });

            Assert.AreEqual("BAD TEST: unexpected value 0", exception.Message);
        }
예제 #16
0
        public void FieldBad()
        {
            var exception = Assert.Catch <BadTestException>(() =>
            {
                var mc = new MyClass(false, false, false, true);

                RunTest(AnyValue.IsValid,
                        () => mc.Method(),
                        SmartAssert.ChangedTo(() => mc.MyField, 0));
            });

            Assert.AreEqual("BAD TEST: unexpected value 0", exception.Message);
        }
        public void PropertyError()
        {
            var exception = Assert.Catch <SmartTestException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        Assign(() => mc.MyPropertyError, 1),
                        SmartAssert.ChangedTo());
            });

            Assert.AreEqual("Change is wrong. Expected 1, but was 0", exception.Message);
        }
        public void PropertyBad()
        {
            var exception = Assert.Catch <BadTestException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        Assign(() => mc.MyProperty, 0),
                        SmartAssert.ChangedTo());
            });

            Assert.AreEqual("BAD TEST: unexpected value 0", exception.Message);
        }
        public void PropertyNotAssignment()
        {
            var exception = Assert.Catch <BadTestException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        () => mc.MyProperty,
                        SmartAssert.ChangedTo());
            });

            Assert.AreEqual("BAD TEST: Act is not an assignment", exception.Message);
        }
        public void FieldNotAssignment()
        {
            var exception = Assert.Catch <InconclusiveException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        () => mc.MyField,
                        SmartAssert.ChangedTo());
            });

            Assert.AreEqual("BAD TEST: Act is not an assignment", exception.Message);
        }
예제 #21
0
        public void NotChangedExcept_BadExcept()
        {
            var exception = Assert.Catch <SmartTestException>(() =>
            {
                var mc = new MyClass();

                RunTest(AnyValue.IsValid,
                        Assign(() => mc.MyProperty2, 1),
                        SmartAssert.NotChangedExceptAct(),
                        SmartAssert.ChangedTo());
            });

            StringAssert.Contains("Property 'NotChangedTestsExceptImplicit+MyClass.MyProperty3' has changed", exception.Message);
        }