Exemple #1
0
        public void ContainsSucceeds()
        {
            //Arrange
            string      assemblyName = null;
            string      typeName     = null;
            string      key          = TestsConstants.TestGuidName;
            string      resultKey    = null;
            ConfigLevel resultLevel  = ConfigLevel.CurrentSPWeb;

            MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (assembly, type, args) =>
            {
                assemblyName = assembly;
                typeName     = type;
                var proxyArgs = args as ProxyArgs.ContainsKeyDataArgs;
                resultKey   = proxyArgs.Key;
                resultLevel = (ConfigLevel)proxyArgs.Level;
                return(true);
            };

            var target = new SandboxFarmPropertyBag();

            //Act
            bool result = target.Contains(key);

            //Assert
            Assert.AreEqual <string>(assemblyName, ProxyArgs.ContainsKeyDataArgs.OperationAssemblyName);
            Assert.AreEqual <string>(typeName, ProxyArgs.ContainsKeyDataArgs.OperationTypeName);
            Assert.AreEqual(key, resultKey);
            Assert.AreEqual(ConfigLevel.CurrentSPFarm, resultLevel);
            Assert.IsTrue(result);
        }
Exemple #2
0
        public void ContainsKeyWithNullKeyThrowsArgumentNullException()
        {
            //Arrange
            var target = new SandboxFarmPropertyBag();

            //Act
            bool result = target.Contains(null);

            //Assert caught by expected exception
        }