CustomerExample.BO.Customer.SetAuthorisation C# (CSharp) Method

SetAuthorisation() public method

This method has been added and made public purely for the purposes of testing.
public SetAuthorisation ( IBusinessObjectAuthorisation authorisation ) : void
authorisation IBusinessObjectAuthorisation
return void
        public void SetAuthorisation(IBusinessObjectAuthorisation authorisation)
        {
            SetAuthorisationRules(authorisation);
        }
    }

Usage Example

        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);
        }
All Usage Examples Of CustomerExample.BO.Customer::SetAuthorisation