Test.CustomerExample.BO.AuthorisationStub.IsAuthorised C# (CSharp) 메소드

IsAuthorised() 공개 메소드

Whether the user is authorised to perform this action or not. This is an implementation of the IBusinessObjectAuthorisation method.
public IsAuthorised ( BusinessObjectActions actionToPerform ) : bool
actionToPerform BusinessObjectActions
리턴 bool
        public bool IsAuthorised(BusinessObjectActions actionToPerform)
        {
            return (actionsAllowed.Contains(actionToPerform));
        }
    }

Usage Example

예제 #1
0
        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);
        }
All Usage Examples Of Test.CustomerExample.BO.AuthorisationStub::IsAuthorised