public void Execute_ContainsKeyReturnsFalse_WithValidKeyNotSetAtWebAppLevel() { //arrange var args = new ContainsKeyDataArgs(); string key = ConfigManager.PnPKeyNamespace + "." + TestsConstants.TestGuidName; args.Key = key; args.Level = (int)ConfigLevel.CurrentSPWebApplication; args.SiteId = TestsConstants.TestGuid; var proxyOp = new ContainsKeyOperation(); var webApp = new BSPWebApplication(); WebAppSettingStore wss = new WebAppSettingStore(); var webPO = new MSPPersistedObject((SPPersistedObject)webApp.Instance); MSPSite.ConstructorGuid = (instance, guid) => { var site = new MSPSite(instance) { WebApplicationGet = () => { webPO.GetChildString <WebAppSettingStore>((s) => wss); return(webApp); }, Dispose = () => { } }; }; //Act var target = proxyOp.Execute(args); //Assert Assert.IsInstanceOfType(target, typeof(bool)); Assert.IsFalse((bool)target); }
public void GetHierarchy_GetsHierarchyForFullTrust() { //Arrange var site = new BSPSite(); var web = site.SetRootWeb(); var webApp = new BSPWebApplication(); site.WebApplication = webApp; var f = new BSPConfiguredFarm(); webApp.Farm = SPFarm.Local; //Act IPropertyBagHierarchy target = HierarchyBuilder.GetHierarchy(web); //Assert Assert.IsInstanceOfType(target, typeof(FullTrustPropertyBagHierarchy)); }
public void Execute_ContainsKeyReturnsTrue_WithValidKeyAtWebAppLevel() { //arrange SPWebAppPropertyBag.ClearCache(); var args = new ContainsKeyDataArgs(); string key = ConfigManager.PnPKeyNamespace + "." + TestsConstants.TestGuidName; args.Key = key; args.Level = (int)ConfigLevel.CurrentSPWebApplication; args.SiteId = TestsConstants.TestGuid; var proxyOp = new ContainsKeyOperation(); string expectedData = "{92700BB6-B144-434F-A97B-5F696068A425}"; var webApp = new BSPWebApplication(); WebAppSettingStore wss = new WebAppSettingStore(); var webPO = new MSPPersistedObject((SPPersistedObject)webApp.Instance); wss.Settings[key] = expectedData; MSPSite.ConstructorGuid = (instance, guid) => { var site = new MSPSite(instance) { WebApplicationGet = () => { webPO.GetChildString <WebAppSettingStore>((s) => wss); return(webApp); }, Dispose = () => { } }; }; //Act var target = proxyOp.Execute(args); //Assert . Assert.IsInstanceOfType(target, typeof(bool)); Assert.IsTrue((bool)target); }
public void ctor_ValidStackBuilt() { //Arrange var site = new BSPSite(); BSPWeb web = site.SetRootWeb(); web.Site = site; var webApp = new BSPWebApplication(); site.WebApplication = webApp; var f = new BSPConfiguredFarm(); webApp.Farm = SPFarm.Local; //Act var stack = new FullTrustPropertyBagHierarchy(web); //Assert Assert.IsTrue(stack.PropertyBags.Count() == 4); Assert.IsInstanceOfType(stack.PropertyBags.First(), typeof(SPWebPropertyBag)); Assert.IsInstanceOfType(stack.PropertyBags.Skip(1).First(), typeof(SPSitePropertyBag)); Assert.IsInstanceOfType(stack.PropertyBags.Skip(2).First(), typeof(SPWebAppPropertyBag)); Assert.IsInstanceOfType(stack.PropertyBags.Skip(3).First(), typeof(SPFarmPropertyBag)); }
public BSPConfiguredWebApp() { BSPWebApplication webApp = new BSPWebApplication(); wss = new WebAppSettingStore(); }