상속: BusinessObject
        protected static FakeContactPerson CreateFakeContactPersonWithManyAddresses()
        {
            var savedContactPerson = FakeContactPerson.CreateSavedContactPerson();

            FakeAddress.CreateSavedAddress(savedContactPerson);
            FakeAddress.CreateSavedAddress(savedContactPerson);
            FakeAddress.CreateSavedAddress(savedContactPerson);
            return(savedContactPerson);
        }
        public static FakeAddress CreateSavedAddress(FakeContactPerson contactPerson)
        {
            var fakeAddress = new FakeAddress {
                ContactPerson = contactPerson
            };

            fakeAddress.Save();
            return(fakeAddress);
        }
예제 #3
0
        public void Test_DeleteBusinessObject_Failure()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter  = GetTransactionCommitter();
            DefaultBODeletor      businessObjectDeletor = new DefaultBODeletor();
            IBusinessObject       boToDelete            = new FakeAddress();
            Exception             expectedException     = new Exception();

            transactionCommitter.Stub(t => t.CommitTransaction()).Throw(expectedException);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------

            try
            {
                businessObjectDeletor.DeleteBusinessObject(boToDelete);
                Assert.Fail("Expected to throw an Exception");
            }
            //---------------Test Result -----------------------
            catch (Exception exception)
            {
                Assert.AreSame(expectedException, exception);
            }
        }
        public void Test_DeleteBusinessObject_Failure()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter = GetTransactionCommitter();
            DefaultBODeletor businessObjectDeletor = new DefaultBODeletor();
            IBusinessObject boToDelete = new FakeAddress();
            Exception expectedException = new Exception();
            transactionCommitter.Stub(t => t.CommitTransaction()).Throw(expectedException);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------

            try
            {
                businessObjectDeletor.DeleteBusinessObject(boToDelete);
                Assert.Fail("Expected to throw an Exception");
            }
                //---------------Test Result -----------------------
            catch (Exception exception)
            {
                Assert.AreSame(expectedException, exception);
            }
        }
 protected static FakeAddress CreateFakeAddressWithFakeContactPerson()
 {
     return(FakeAddress.CreateSavedAddress(FakeContactPerson.CreateSavedContactPerson()));
 }
 public static FakeAddress CreateSavedAddress(FakeContactPerson contactPerson)
 {
     var fakeAddress = new FakeAddress {ContactPerson = contactPerson};
     fakeAddress.Save();
     return fakeAddress;
 }