public void Execute_ThrowsArgumentNullException_WhenArgsAreNull()
        {
            var proxyOp = new ProxyInstalledOperation();

            //Act
            proxyOp.Execute(null);

            //Assert caught by exception...
        }
        public void Execute_ReturnsConfigurationException_WhenWrongArgTypeProvided()
        {
            var proxyOp = new ProxyInstalledOperation();
            var args    = new ReadConfigArgs();

            //Act
            object result = proxyOp.Execute(args);

            //Assert
            Assert.IsInstanceOfType(result, typeof(ConfigurationException));
        }
        public void Execute_ReturnsArgumentNullException_WhenTypeNameIsNull()
        {
            var proxyOp = new ProxyInstalledOperation();
            var args    = new ProxyInstalledArgs();

            args.AssemblyName = ProxyInstalledArgs.OperationAssemblyName;
            args.TypeName     = null;

            //Act
            object result = proxyOp.Execute(args);

            //Assert
            Assert.IsInstanceOfType(result, typeof(ArgumentNullException));
        }
        public void Execute_ReturnsTrue_WhenProxyExists()
        {
            var args    = new ProxyInstalledArgs();
            var opsList = new List <SPProxyOperationType>();

            opsList.Add(new SPProxyOperationType(ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName));
            opsList.Add(new SPProxyOperationType(ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName));
            opsList.Add(new SPProxyOperationType(LoggingOperationArgs.OperationAssemblyName, LoggingOperationArgs.OperationTypeName));
            var userService = new MSPUserCodeService();

            userService.ProxyOperationTypesGet = () => opsList;
            MSPUserCodeService.LocalGet        = () => userService;

            args.AssemblyName = LoggingOperationArgs.OperationAssemblyName;
            args.TypeName     = LoggingOperationArgs.OperationTypeName;
            var proxyOp = new ProxyInstalledOperation();

            //Act
            var result = proxyOp.Execute(args);

            //Assert
            Assert.IsInstanceOfType(result, typeof(bool));
            Assert.IsTrue((bool)result);
        }