public void CheckAccess_AccessDenied()
        {
            ExpectObjectSecurityStrategyHasAccessForSecurableObject(GeneralAccessTypes.Read, false);
            SecurableObject thisObject = new SecurableObject(_mockObjectSecurityStrategy);
            TestFunctionWithPermissionsFromInstanceMethod function = new TestFunctionWithPermissionsFromInstanceMethod(thisObject);

            function.ThisObject = thisObject; // Required because in this test the WxeFunction has not started executing.
            _mocks.ReplayAll();

            _securityAdapter.CheckAccess(function);
        }
        public void HasAccess_AccessGranted()
        {
            ExpectObjectSecurityStrategyHasAccessForSecurableObject(GeneralAccessTypes.Read, true);
            SecurableObject thisObject = new SecurableObject(_mockObjectSecurityStrategy);
            TestFunctionWithPermissionsFromInstanceMethod function = new TestFunctionWithPermissionsFromInstanceMethod(thisObject);

            function.ThisObject = thisObject; // Required because in this test the WxeFunction has not started executing.
            _mocks.ReplayAll();

            bool hasAccess = _securityAdapter.HasAccess(function);

            _mocks.VerifyAll();
            Assert.That(hasAccess, Is.True);
        }
        public void CheckAccess_WithinSecurityFreeSection_AccessGranted()
        {
            SecurableObject thisObject = new SecurableObject(_mockObjectSecurityStrategy);
            TestFunctionWithPermissionsFromInstanceMethod function = new TestFunctionWithPermissionsFromInstanceMethod(thisObject);

            function.ThisObject = thisObject; // Required because in this test the WxeFunction has not started executing.
            _mocks.ReplayAll();

            using (SecurityFreeSection.Activate())
            {
                _securityAdapter.CheckAccess(function);
            }

            _mocks.VerifyAll();
        }