public void Test_BusinessObjectAuthorisation_AllowUpdate_False() { //---------------Set up test pack------------------- IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanUpdate_False(); Customer customer = new Customer(); customer.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsFalse(authorisationStub.IsAuthorised(BusinessObjectActions.CanUpdate)); //---------------Execute Test ---------------------- string message; bool isEditable = customer.IsEditable(out message); //---------------Test Result ----------------------- Assert.IsFalse(isEditable); StringAssert.Contains("The logged on user", message); StringAssert.Contains("is not authorised to update ", message); }
public void Test_BusinessObjectAuthorisation_AllowUpdate() { //---------------Set up test pack------------------- IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanUpdate_True(); Customer customer = new Customer(); customer.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsTrue(authorisationStub.IsAuthorised(BusinessObjectActions.CanUpdate)); //---------------Execute Test ---------------------- string message; bool isEditable = customer.IsEditable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isEditable); Assert.AreEqual("", message); }