This class is a very simple stub implementation of IBusinessObjectAuthorisation. It is not intended to represent how a read authorisation policy would be implemented by is instead used only for testing.
Inheritance: IBusinessObjectAuthorisation
 private static IBusinessObjectAuthorisation GetAuthorisationStub_CanRead_False()
 {
     IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub();
     return authorisationStub;
 }
        public void Test_BusinessObjectAuthorisation_AllowRead_False()
        {
            //---------------Set up test pack-------------------
            IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub();
            Customer customer = new Customer();
            customer.SetAuthorisation(authorisationStub);

            //---------------Assert Precondition----------------
            Assert.IsFalse(authorisationStub.IsAuthorised(BusinessObjectActions.CanRead));

            //---------------Execute Test ----------------------
            string message;
            bool isReadable = customer.IsReadable(out message);

            //---------------Test Result -----------------------
            Assert.IsFalse(isReadable);
            StringAssert.Contains("The logged on user", message);
            StringAssert.Contains("is not authorised to read ", message);
        }
 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()
        {
            //---------------Set up test pack-------------------
            IBusinessObjectAuthorisation authorisationStub = new AuthorisationStub();
            authorisationStub.AddAuthorisedRole("A Role", BusinessObjectActions.CanRead);
            Customer customer = new Customer();
            customer.SetAuthorisation(authorisationStub);

            //---------------Assert Precondition----------------
            Assert.IsTrue(authorisationStub.IsAuthorised(BusinessObjectActions.CanRead));

            //---------------Execute Test ----------------------
            string message;
            bool isReadable = customer.IsReadable(out message);

            //---------------Test Result -----------------------
            Assert.IsTrue(isReadable);
            Assert.AreEqual("", message);
        }