Ejemplo n.º 1
0
        public void IsProxyInstalled_ThrowsExceptionWhenExceptionReturned()
        {
            //Arrange
            SetupInGac();

            var target = new TestableApplicationContextProvider(true);

            MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) =>
            {
                var checkargs = args as ProxyInstalledArgs;

                if (checkargs.AssemblyName == ProxyInstalledArgs.OperationAssemblyName &&
                    checkargs.TypeName == ProxyInstalledArgs.OperationTypeName)
                {
                    return(true);
                }

                return(new LoggingException());
            };

            ConfigurationException configEx = null;

            //Act
            try
            {
                bool result = target.IsProxyInstalled("foo", "bar");
            }
            catch (ConfigurationException ex)
            {
                configEx = ex;
            }

            //Assert
            Assert.IsNotNull(configEx);
        }
Ejemplo n.º 2
0
        public void IsProxyInstalled_ReturnsFalseWhenFalseReturned()
        {
            //Arrange
            SetupInGac();

            var target = new TestableApplicationContextProvider(true);

            MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) =>
            {
                var checkargs = args as ProxyInstalledArgs;

                if (checkargs.AssemblyName == ProxyInstalledArgs.OperationAssemblyName &&
                    checkargs.TypeName == ProxyInstalledArgs.OperationTypeName)
                {
                    return(true);
                }

                return(false);
            };
            //Act
            bool result = target.IsProxyInstalled("foo", "bar");

            //Assert
            Assert.IsFalse(result);
        }