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); }
public void GetIndexerSucceeds() { //Arrange string assemblyName = null; string typeName = null; string key = TestsConstants.TestGuidName; string resultKey = null; ConfigLevel resultLevel = ConfigLevel.CurrentSPWeb; string targetValue = "foobar"; MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (assembly, type, args) => { assemblyName = assembly; typeName = type; var proxyArgs = args as ProxyArgs.ReadConfigArgs; resultKey = proxyArgs.Key; resultLevel = (ConfigLevel)proxyArgs.Level; return(targetValue); }; var target = new SandboxFarmPropertyBag(); //Act string result = target[key]; //Assert Assert.AreEqual <string>(assemblyName, ProxyArgs.ReadConfigArgs.OperationAssemblyName); Assert.AreEqual <string>(typeName, ProxyArgs.ReadConfigArgs.OperationTypeName); Assert.AreEqual(key, resultKey); Assert.AreEqual(ConfigLevel.CurrentSPFarm, resultLevel); Assert.AreEqual(targetValue, result); }
public void ContainsKeyWithNullKeyThrowsArgumentNullException() { //Arrange var target = new SandboxFarmPropertyBag(); //Act bool result = target.Contains(null); //Assert caught by expected exception }
public void RemoveThrowsInvalidOperationException() { //Arrange var target = new SandboxFarmPropertyBag(); //Act target.Remove("foobar"); //Assert caught by exception }
public void SetIndexerWithNullThrowsArgumentNullException() { //Arrange var target = new SandboxFarmPropertyBag(); //Act string result = target[null]; //Assert caught by expected exception }
public void SetIndexerThrowsInvalidOperationException() { //Arrange var target = new SandboxFarmPropertyBag(); //Act target["foo"] = "bar"; //Assert caught by expected exception }
public void GetLevelSucceeds() { //Arrange var target = new SandboxFarmPropertyBag(); //Act ConfigLevel level = target.Level; //Assert Assert.AreEqual <ConfigLevel>(ConfigLevel.CurrentSPFarm, level); }