Пример #1
0
        public void GetHierarchy_GetsHierarchyForSandbox()
        {
            //Arrange
            var context = new MockAppContextProvider();

            context.IsProxyInstalledRetValue = false;
            context.SetSandbox();
            SharePointEnvironment.ApplicationContextProvider = context;
            BSPSite site = new BSPSite();
            var     web  = site.SetRootWeb();

            web.ServerRelativeUrl = "foo/bar";
            BSPList list = web.Lists.SetOne();

            list.Title = ConfigurationList.ConfigListName;
            web.ID     = TestsConstants.TestGuid;
            site.ID    = new Guid("{7C039254-10B7-49F0-AA8D-F592206C7130}");
            var moleWeb = new Microsoft.SharePoint.Moles.MSPWeb(web);

            moleWeb.GetListString = (listUrl) =>
            {
                if (listUrl == "foo/bar/Lists/" + ConfigurationList.ConfigListName)
                {
                    return(list);
                }
                return(null);
            };

            //Act
            IPropertyBagHierarchy target = HierarchyBuilder.GetHierarchy(web);

            //Assert
            Assert.IsInstanceOfType(target, typeof(SandboxPropertyBagHierarchy));
        }
Пример #2
0
        public void GetHierarchy_GetsHierarchyForFarm()
        {
            //Arrange
            var f = new BSPConfiguredFarm();

            //Act
            IPropertyBagHierarchy target = HierarchyBuilder.GetHierarchy(null);

            //Assert
            Assert.IsInstanceOfType(target, typeof(FarmPropertyBagHierarchy));
        }
Пример #3
0
        public void GetHierarchy_GetsHierarchyForSandboxFarm()
        {
            //Arrange
            var context = new MockAppContextProvider();

            context.AddProxyType(ProxyArgs.ReadConfigArgs.OperationTypeName);
            context.AddProxyType(ProxyArgs.ProxyInstalledArgs.OperationTypeName);
            context.SetSandbox();
            SharePointEnvironment.ApplicationContextProvider = context;

            //Act
            IPropertyBagHierarchy target = HierarchyBuilder.GetHierarchy(null);

            //Assert
            Assert.IsInstanceOfType(target, typeof(SandboxFarmPropertyBagHierarchy));
        }
Пример #4
0
        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));
        }