private static IBusinessObjectAuthorisation GetAuthorisationStub_CanCreate_True() { IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanCreate); return(authorisationStub); }
public void Test_BusinessObjectAuthorisation_AllowCreate_False() { //---------------Set up test pack------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsFalse(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanCreate)); //---------------Execute Test ---------------------- string message; bool isCreatable = myBoStub.IsCreatable(out message); //---------------Test Result ----------------------- Assert.IsFalse(isCreatable); StringAssert.Contains("The logged on user", message); StringAssert.Contains("is not authorised to create ", message); }
public void Test_BusinessObjectAuthorisation_AllowRead() { //---------------Set up test pack------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanRead); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsTrue(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanRead)); //---------------Execute Test ---------------------- string message; bool isReadable = myBoStub.IsReadable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isReadable); Assert.AreEqual("", message); }
private static IBusinessObjectAuthorisation GetAuthorisationStub_CanRead_False() { IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); return(authorisationStub); }
private static IBusinessObjectAuthorisation GetAuthorisationStub_CanRead_False() { IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); return authorisationStub; }
private static IBusinessObjectAuthorisation GetAuthorisationStub_CanRead_True() { IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanRead); authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanCreate); return authorisationStub; }
public void Test_BusinessObjectAuthorisation_AllowRead_False() { //---------------Set up test pack------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsFalse(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanRead)); //---------------Execute Test ---------------------- string message; bool isReadable = myBoStub.IsReadable(out message); //---------------Test Result ----------------------- Assert.IsFalse(isReadable); StringAssert.Contains("The logged on user", message); StringAssert.Contains("is not authorised to read ", message); }
public void Test_BusinessObjectAuthorisation_AllowRead() { //---------------Set up test pack------------------- MyBoAuthenticationStub.LoadDefaultClassDef(); IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub(); authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanRead); MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub(); myBoStub.SetAuthorisation(authorisationStub); //---------------Assert Precondition---------------- Assert.IsTrue(authorisationStub.IsAuthorised(myBoStub, BusinessObjectActions.CanRead)); //---------------Execute Test ---------------------- string message; bool isReadable = myBoStub.IsReadable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isReadable); Assert.AreEqual("", message); }