Exemple #1
0
        public void NotChangedExcept()
        {
            var mc = new MyClass();

            RunTest(AnyValue.IsValid,
                    Assign(() => mc.MyProperty1, 1),
                    SmartAssert.NotChangedExceptAct(),
                    SmartAssert.ChangedTo());
        }
Exemple #2
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);
        }
Exemple #3
0
        public void SetAddress_HappyPath()
        {
            RunTest(ValidString.HasContent,
                    // Act
                    // To Test Assignment, use Assign
                    Assign(() => _Customer.Address, "Quebec"),

                    // Assert (and implicit Assume)
                    // Before Act: Register to PropertyChangedEvent
                    // After Act: Assert PropertyChanged raised when assignment is run, with "Address" as PropertyName
                    SmartAssert.Raised_PropertyChanged(),
                    // Before Act: Assume _Customer.Address != "Quebec" before assignment, keep track of all other public properties
                    // AfterAct: _Customer.Address == "Quebec", all other public properties did not change
                    SmartAssert.NotChangedExceptAct()
                    );
        }