public void Test_BusinessObjectAuthorisation_AllowDelete_False() { //---------------Set up test pack------------------- IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanDelete_False(); Customer customer = new Customer(); customer.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsFalse(authorisationStub.IsAuthorised(BusinessObjectActions.CanDelete)); //---------------Execute Test ---------------------- string message; bool isDeletable = customer.IsDeletable(out message); //---------------Test Result ----------------------- Assert.IsFalse(isDeletable); StringAssert.Contains("The logged on user", message); StringAssert.Contains("is not authorised to delete ", message); }
public void Test_BusinessObjectAuthorisation_AllowDelete() { //---------------Set up test pack------------------- IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanDelete_True(); Customer customer = new Customer(); customer.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsTrue(authorisationStub.IsAuthorised(BusinessObjectActions.CanDelete)); //---------------Execute Test ---------------------- string message; bool isDeletable = customer.IsDeletable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isDeletable); Assert.AreEqual("", message); }