示例#1
0
        public void IsProxyCheckerInstalled_ReturnsFalseWhenTypeLoadExceptionThrown()
        {
            //Arrange
            SetupInGac();
            var target = new ApplicationContextProvider();

            MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) =>
            {
                throw new TypeLoadException();
            };
            //Act
            bool result = target.IsProxyCheckerInstalled();

            //Assert
            Assert.IsFalse(result);
        }
示例#2
0
        public void IIsProxyCheckerInstalled_ReturnsFalse_WhenNotInGac()
        {
            //Arrange
            MCodeAccessPermission mock;

            MSecurityPermission.ConstructorSecurityPermissionFlag = (instance, flags) =>
            {
                mock = new MCodeAccessPermission(instance)
                {
                    Assert = () => { throw new SecurityException(); }
                };
            };

            var target = new ApplicationContextProvider();

            //Act
            bool result = target.IsProxyCheckerInstalled();

            //Assert
            Assert.IsFalse(result);
        }