Ejemplo n.º 1
0
        public void TestEnsureInTransaction()
        {
            var testObject = new TestInpcObject();

            // Ensure that we only allow changes inside a transaction
            Assert.That(() => testObject.IntValue = 42, Throws.Exception.TypeOf <InvalidOperationException>());
        }
Ejemplo n.º 2
0
        public void TestNotifyChanged()
        {
            var                   testObject            = new TestInpcObject();
            ChangedCalled         changedCalled         = EnsureChangedCalled(testObject);
            PropertyChangedCalled propertyChangedCalled = EnsurePropertyChangedCalled(testObject);

            Transaction.Start();

            testObject.IntValue = 1;
            propertyChangedCalled.AssertCalledWith(testObject, "IntValue");
            propertyChangedCalled.Reset();

            testObject.IntValue = 2;
            propertyChangedCalled.AssertCalledWith(testObject, "IntValue");
            propertyChangedCalled.Reset();

            testObject.IntValue = 3;
            propertyChangedCalled.AssertCalledWith(testObject, "IntValue");

            CompleteTransactionAndAssertChangedCalled(changedCalled);
        }