예제 #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_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));
        }