Beispiel #1
0
        public void GetPropertyBagForLevel_WithMultiplePropertyBags_ReturnsBag()
        {
            //Arrange
            var hierarchy = new TestablePropertyBagHierarchy();

            hierarchy.AddPropertyBag(GetPropertyBag(ConfigLevel.CurrentSPWeb));
            hierarchy.AddPropertyBag(GetPropertyBag(ConfigLevel.CurrentSPSite));
            hierarchy.AddPropertyBag(GetPropertyBag(ConfigLevel.CurrentSPWebApplication));
            hierarchy.AddPropertyBag(GetPropertyBag(ConfigLevel.CurrentSPFarm));

            //Act
            IPropertyBag farmBag   = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPFarm);
            IPropertyBag webBag    = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPWeb);
            IPropertyBag siteBag   = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPSite);
            IPropertyBag webAppBag = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPWebApplication);

            //Assert
            Assert.IsNotNull(farmBag);
            Assert.IsTrue(farmBag.Level == ConfigLevel.CurrentSPFarm);
            Assert.IsNotNull(webBag);
            Assert.IsTrue(webBag.Level == ConfigLevel.CurrentSPWeb);
            Assert.IsNotNull(siteBag);
            Assert.IsTrue(siteBag.Level == ConfigLevel.CurrentSPSite);
            Assert.IsNotNull(webBag);
            Assert.IsTrue(webBag.Level == ConfigLevel.CurrentSPWeb);
        }
Beispiel #2
0
        public void GetPropertyBagForLevel_WithOnePropertyBag_ReturnsBag()
        {
            //Arrange
            var hierarchy = new TestablePropertyBagHierarchy();

            hierarchy.AddPropertyBag(GetPropertyBag(ConfigLevel.CurrentSPWeb));

            //Act
            IPropertyBag bag = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPWeb);

            //Assert
            Assert.IsNotNull(bag);
            Assert.IsTrue(bag.Level == ConfigLevel.CurrentSPWeb);
        }
Beispiel #3
0
        public void GetPropertyBagForMissingLevel_ReturnsNull()
        {
            //Arrange
            var hierarchy = new TestablePropertyBagHierarchy();

            hierarchy.AddPropertyBag(new BIPropertyBag()
            {
                Level = ConfigLevel.CurrentSPFarm
            });

            //Act
            IPropertyBag bag = hierarchy.GetPropertyBagForLevel(ConfigLevel.CurrentSPWeb);

            //Assert
            Assert.IsNull(bag);
        }