public void Test_BusinessObjectAuthorisation_AllowDelete_False() { //---------------Set up test pack------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanDelete_False(); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsFalse(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanDelete)); //---------------Execute Test ---------------------- string message; bool isDeletable = myBoStub.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------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = GetAuthorisationStub_CanDelete_True(); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsTrue(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanDelete)); //---------------Execute Test ---------------------- string message; bool isDeletable = myBoStub.IsDeletable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isDeletable); Assert.AreEqual("", message); }