public void SaveValueAndBusinessObjectNullAndValueNotNull()
        {
            _dataSourceStub.BusinessObject = null;
            _control.DataSource            = _dataSourceStub;
            _control.Property = _propertyStub;
            _control.Value    = "value";

            Assert.That(_control.SaveValueToDomainModel(), Is.False);
            _businessObjectStub.AssertWasNotCalled(stub => stub.SetProperty(null, null), options => options.IgnoreArguments());
        }
Example #2
0
        public void Test_DeleteBusinessObject_Success()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter  = GetTransactionCommitter();
            IBusinessObject       boToDelete            = MockRepository.GenerateMock <IBusinessObject>();
            DefaultBODeletor      businessObjectDeletor = new DefaultBODeletor();

            //---------------Assert Precondition----------------
            Assert.IsNotNull(transactionCommitter);
            transactionCommitter.AssertWasNotCalled(committer => committer.CommitTransaction());
            //---------------Execute Test ----------------------
            businessObjectDeletor.DeleteBusinessObject(boToDelete);
            //---------------Test Result -----------------------
            boToDelete.AssertWasCalled(o => o.MarkForDelete());
            transactionCommitter.AssertWasCalled(committer => committer.CommitTransaction());
            boToDelete.AssertWasNotCalled(o => o.CancelEdits());
        }