Inheritance: SenseNet.ContentRepository.Workspaces.Workspace
コード例 #1
0
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private void CreateTestSite()
        {
            Site site = new Site(Repository.Root);
            site.Name = "Fake Test Site";
            Dictionary<string, string> urlList = new Dictionary<string, string>(3);
            urlList.Add("localhost/fakesiteforms", "Forms");
            urlList.Add("localhost/fakesitewindows", "Windows");
            urlList.Add("localhost/fakesitenone", "None");
            site.UrlList = urlList;
            site.Save();
        }
コード例 #2
0
ファイル: SiteTest.cs プロジェクト: maxpavlov/FlexNet
 public void Site_SiteUrl_Insert()
 {
     var originalSite = new Site(Repository.Root);
     originalSite.UrlList.Add("mytestinterneturl", "Forms");
     var originalSiteUrlList = originalSite.UrlList;
     originalSite.Save();
     var site = Node.Load<Site>(originalSite.Id);
     var b = site.UrlList.Count == originalSiteUrlList.Count;
     originalSite.ForceDelete();
     Assert.IsTrue(b, "Site url list are NOT equal.");
 }
コード例 #3
0
ファイル: ActionTest.cs プロジェクト: maxpavlov/FlexNet
        public static void CreateSandbox(TestContext testContext)
        {

            var site = new Site(Repository.Root);
            site.Name = "TestSiteForActionFramework";
                var urlList = new Dictionary<string, string>();
                urlList.Add("newtesthost", "Windows");
                site.UrlList = urlList;
                site.Save();
            

            //---- Appmodel
            //-------------

                //Root/TestRoot/(apps)
            var siteAppsFolder = new SystemFolder(site);
                siteAppsFolder.Name = "(apps)";
                siteAppsFolder.Save();
            
            //---- Folder
            //-----------

                // /TestRoot/(apps)/Folder
            var siteAppsFolderFolder = new SystemFolder(siteAppsFolder);
                siteAppsFolderFolder.Name = "Folder";
                siteAppsFolderFolder.Save();

                // /TestRoot/(apps)/Folder/App1
            var siteAppsApp1 = new Application(siteAppsFolderFolder);
                siteAppsApp1.Name = "App1";
                siteAppsApp1.Scenario = "sc1,sc4,sc5";
                siteAppsApp1.Save();

                // /TestRoot/(apps)/Folder/App2
            var siteAppsApp2 = new Application(siteAppsFolderFolder);
                siteAppsApp2.Name = "App2";
                siteAppsApp2.Scenario = "sc1,Settings";
                siteAppsApp2.Save();

                // TestRoot/(apps)/Folder/App3
            var siteAppsApp3 = new Application(siteAppsFolderFolder);
                siteAppsApp3.Name = "App3";
                siteAppsApp3.Scenario = "sc1,sc2,sc7,sc10";
                siteAppsApp3.RequiredPermissions = "5";
                siteAppsApp3.Save();

                // TestRoot/(apps)/Folder/App4
            var siteAppsApp4 = new Application(siteAppsFolderFolder);
                siteAppsApp4.Name = "App4";
                siteAppsApp4.Scenario = "sc2,sc6,sc10";
                siteAppsApp4.RequiredPermissions = "5";
                siteAppsApp4.Save();

                //Root/TestRoot/(apps)/Folder/App5
            var siteAppsApp5 = new Application(siteAppsFolderFolder);
                siteAppsApp5.Name = "App5";
                siteAppsApp5.Scenario = "sc11";
                siteAppsApp5.RequiredPermissions = "5;10;11";
                siteAppsApp5.Save();

                //Root/TestRoot/(apps)/Folder/App6
            var siteAppsApp6 = new Application(siteAppsFolderFolder);
                siteAppsApp6.Name = "App6";
                siteAppsApp6.Scenario = "sc12";
                siteAppsApp6.Save();

                //Root/TestRoot/(apps)/Folder/App12
            var siteSampleAppsApp12 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp12.Name = "App12";
                siteSampleAppsApp12.Scenario = "sc20";
                siteSampleAppsApp12.Save();

                //Root/TestRoot/(apps)/Folder/App21
            var siteSampleAppsApp21 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp21.Name = "App21";
                siteSampleAppsApp21.Scenario = "sc21";
                siteSampleAppsApp21.Save();

                //Root/TestRoot/(apps)/Folder/App22
            var siteSampleAppsApp22 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp22.Name = "App22";
                siteSampleAppsApp22.Scenario = "sc22";
                siteSampleAppsApp22.Save();

                //Root/TestRoot/(apps)/Folder/App23
                var siteSampleAppsApp23 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp23.Name = "App23";
                siteSampleAppsApp23.Scenario = "sc23";
                siteSampleAppsApp23.Disabled = true;
                siteSampleAppsApp23.Save();

                //Root/TestRoot/(apps)/Folder/App24
                var siteSampleAppsApp24 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp24.Name = "App24";
                siteSampleAppsApp24.Scenario = "sc24";
                siteSampleAppsApp24.Disabled = true;
                siteSampleAppsApp24.Clear = true;
                siteSampleAppsApp24.Save();

                //Root/TestRoot/(apps)/Folder/App25
                var siteSampleAppsApp25 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp25.Name = "App25";
                siteSampleAppsApp25.Scenario = "sc25";
                siteSampleAppsApp25.Save();

                //Root/TestRoot/Sample
            var siteSample = new SystemFolder(site);
                siteSample.Name = "Sample";
                siteSample.Save();
           
            //---- ContentList
            //----------------

                //Root/TestRoot/(apps)/ContentList
            var siteAppsFolderContentList = new SystemFolder(siteAppsFolder);
                siteAppsFolderContentList.Name = "ContentList";
                siteAppsFolderContentList.Save();

                //Root/TestRoot/Sample2
            var siteSample2 = new ContentList(site);
                siteSample2.Name = "Sample2";
                siteSample2.Save();

                //Root/TestRoot/(apps)/ContentList/App1
            var siteAppsContentListOverrideApp1 = new Application(siteAppsFolderContentList);
                siteAppsContentListOverrideApp1.Name = "App1";
                siteAppsContentListOverrideApp1.Scenario = "sc4,sc5";
                siteAppsContentListOverrideApp1.Save();


                //Root/TestRoot/(apps)/ContentList/ContentListApp1
            var siteAppsContentListApp1 = new Application(siteAppsFolderContentList);
                siteAppsContentListApp1.Name = "ContentListApp1";
                siteAppsContentListApp1.Scenario = "sc2,sc10";
                siteAppsContentListApp1.Save();

                //Root/TestRoot/Apps/ContentList/ContentListApp2
            var siteAppsContentListApp2 = new Application(siteAppsFolderContentList);
                siteAppsContentListApp2.Name = "ContentListApp2";
                siteAppsContentListApp2.Scenario = "sc1";
                siteAppsContentListApp2.Save();

                //Root/TestRoot/(apps)/ContentList/ContentListApp3
            var siteAppsContentListApp3 = new Application(siteAppsFolderContentList);
                siteAppsContentListApp3.Name = "ContentListApp3";
                siteAppsContentListApp3.Scenario = "sc1,sc2,sc3,mySettings";
                siteAppsContentListApp3.Save();

                //Root/TestRoot/(apps)/ContentList/App6
            var siteAppsContentListOverrideApp6 = new Application(siteAppsFolderContentList);
                siteAppsContentListOverrideApp6.Name = "App6";
                siteAppsContentListOverrideApp6.Scenario = "sc12";
                siteAppsContentListOverrideApp6.RequiredPermissions = "11";
                siteAppsContentListOverrideApp6.Save();
            
            //---- This structure under Sample
            //--------------------------------

                //Root/TestRoot/Sample/(apps)
            var siteSampleApps = new SystemFolder(siteSample);
                siteSampleApps.Name = "(apps)";
                siteSampleApps.Save();

                //Root/TestRoot/Sample/(apps)/This
            var siteSampleAppsThis = new SystemFolder(siteSampleApps);
                siteSampleAppsThis.Name = "This";
                siteSampleAppsThis.Save();

                //Root/TestRoot/Sample/(apps)/This/App12
            var siteSampleAppsThisApp12 = new Application(siteSampleAppsThis);
                siteSampleAppsThisApp12.Name = "App12";
                siteSampleAppsThisApp12.Scenario = "sc20";
                siteSampleAppsThisApp12.Save();

                //Root/TestRoot/Sample/(apps)/Folder
            var siteSampleAppsFolder = new SystemFolder(siteSampleApps);
                siteSampleAppsFolder.Name = "Folder";
                siteSampleAppsFolder.Save();

                //Root/TestRoot/Sample/(apps)/Folder/App21
            var siteSampleAppsFolderApp21 = new Application(siteSampleAppsFolder);
                siteSampleAppsFolderApp21.Name = "App21";
                siteSampleAppsFolderApp21.Scenario = "sc21";
                siteSampleAppsFolderApp21.Save();

                //Root/TestRoot/Sample/(apps)/Folder/App22
                var siteSampleAppsFolderApp22 = new Application(siteSampleAppsFolder);
                siteSampleAppsFolderApp22.Name = "App22";
                siteSampleAppsFolderApp22.Scenario = "sc22";
                siteSampleAppsFolderApp22.Disabled = true;
                siteSampleAppsFolderApp22.Save();

                //Root/TestRoot/Sample/(apps)/Folder/App23
                var siteSampleAppsFolderApp23 = new Application(siteSampleAppsFolder);
                siteSampleAppsFolderApp23.Name = "App23";
                siteSampleAppsFolderApp23.Scenario = "sc23";
                siteSampleAppsFolderApp23.Disabled = true;
                siteSampleAppsFolderApp23.Save();

                //Root/TestRoot/Sample/(apps)/Folder/App24
                var siteSampleAppsFolderApp24 = new Application(siteSampleAppsFolder);
                siteSampleAppsFolderApp24.Name = "App24";
                siteSampleAppsFolderApp24.Scenario = "sc24";
                siteSampleAppsFolderApp24.RequiredPermissions = "5";
                siteSampleAppsFolderApp24.Save();

                //Root/TestRoot/Sample/(apps)/Folder/App25
                var siteSampleAppsFolderApp25 = new Application(siteSampleAppsFolder);
                siteSampleAppsFolderApp25.Name = "App25";
                siteSampleAppsFolderApp25.Scenario = "sc25";
                siteSampleAppsFolderApp25.Clear = true;
                siteSampleAppsFolderApp25.Save();



            
            // ---- Subfolder
            // --------------

                //Root/TestRoot/Sample/SubFolder
            var siteSampleSubFolder = new SystemFolder(siteSample);
                siteSampleSubFolder.Name = "SubFolder";
                siteSampleSubFolder.Save();

                //Root/TestRoot/Sample/SubFolder/(apps)
            var siteSampleSubFolderApps = new SystemFolder(siteSampleSubFolder);
            siteSampleSubFolderApps.Name = "(apps)";
            siteSampleSubFolderApps.Save();

            //Root/TestRoot/Sample/SubFolder/(apps)/This
            var siteSampleSubFolderAppsThis = new SystemFolder(siteSampleSubFolderApps);
            siteSampleSubFolderAppsThis.Name = "This";
            siteSampleSubFolderAppsThis.Save();

            //Root/TestRoot/Sample/SubFolder/(apps)/This/App24
            var siteSampleSubFolderAppsThisApp24 = new Application(siteSampleSubFolderAppsThis);
            siteSampleSubFolderAppsThisApp24.Name = "App24";
            siteSampleSubFolderAppsThisApp24.Scenario = "sc24";
            siteSampleSubFolderAppsThisApp24.Disabled = true;
            siteSampleSubFolderAppsThisApp24.Save();


        }
コード例 #4
0
ファイル: Common.cs プロジェクト: maxpavlov/FlexNet
		public static Site CreateTestSite(string name)
		{
			Site site = null;
			site = Node.LoadNode(string.Concat("/Root/", name)) as Site;
			if (site == null)
			{
				site = new Site(Repository.Root);
				site.Name = name;
				site.Save();
			}
			return site;
		}
コード例 #5
0
        private static void CreatePlayGround()
        {
            DestroyPlayground();

            // /Root
            //      |
            //      +-ContentTemplates
            //      |   |
            //      |   +-File
            //      |   |   |
            //      |   |   +-file1.txt
            //      |   |
            //      |   +-ContentList
            //      |       |
            //      |       +-list1
            //      |
            //      +-CTemplateTests
            //          |
            //          +-CtSite
            //          |   |
            //          |   +-ContentTemplates
            //          |   |   |
            //          |   |   +-File
            //          |   |       |
            //          |   |       +-file1.txt
            //          |   |
            //          |   +-CtWorkspace1
            //          |   |   |
            //          |   |   +-ContentTemplates
            //          |   |   |   |
            //          |   |   |   +-ContentList
            //          |   |   |       |
            //          |   |   |       +-list1
            //          |   |   +-CtList1
            //          |   |   |   |
            //          |   |   |   +-ContentTemplates
            //          |   |   |       |
            //          |   |   |       +-File
            //          |   |   |           |
            //          |   |   |           +-file1.txt
            //          |   |   +-CtList2
            //          |   | 
            //          |   +-CtWorkspace2
            //          | 
            //          +-CtWorkspace3

            //global template folder
            var ctfGlobal = Node.LoadNode(Repository.ContentTemplateFolderPath);
            if (ctfGlobal == null)
            {
                ctfGlobal = new SystemFolder(Node.LoadNode("/Root")) {Name = Repository.ContentTemplatesFolderName};
                ctfGlobal.Save();
            }

            //create GLOBAL content template type folders
            var folderGlobalCtFile1 = Node.Load<Folder>(RepositoryPath.Combine(ctfGlobal.Path, "File"));
            if (folderGlobalCtFile1 == null)
            {
                folderGlobalCtFile1 = new Folder(ctfGlobal) { Name = "File" };
                folderGlobalCtFile1.Save();
            }
            var folderGlobalCtList1 = Node.Load<Folder>(RepositoryPath.Combine(ctfGlobal.Path, "ContentList"));
            if (folderGlobalCtList1 == null)
            {
                folderGlobalCtList1 = new Folder(ctfGlobal) { Name = "ContentList" };
                folderGlobalCtList1.Save();
            }

            //create GLOBAL content templates
            _fileGlobalTemplate1 = Node.Load<File>(RepositoryPath.Combine(folderGlobalCtFile1.Path, _testFileName));
            if (_fileGlobalTemplate1 == null)
            {
                _fileGlobalTemplate1 = new File(folderGlobalCtFile1) { Name = _testFileName, Index = 30 };
                _fileGlobalTemplate1.Save();
            }
            _listGlobalTemplate1 = Node.Load<ContentList>(RepositoryPath.Combine(folderGlobalCtList1.Path, _testListTemplateName));
            if (_listGlobalTemplate1 == null)
            {
                _listGlobalTemplate1 = new ContentList(folderGlobalCtList1) { Name = _testListTemplateName, Index = 30 };
                _listGlobalTemplate1.Save();
            }

            //create site, workspace and list
            var site = new Site(TestRoot) {Name = "CtSite"};
            site.UrlList.Add("mytemplatetestinterneturl", "Forms");
            site.Save();

            var ws = new Workspace(site) { Name = "CtWorkspace2", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace"), ContentType.GetByName("File") } };
            ws.Save();

            ws = new Workspace(TestRoot) { Name = "CtWorkspace3", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace"), ContentType.GetByName("File") } };
            ws.Save();

            ws = new Workspace(site) { Name = "CtWorkspace1", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("ContentList"), ContentType.GetByName("Workspace") } };
            ws.Save();

            _list1 = new ContentList(TestWorkspace) { Name = "CtList1", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("File") } };
            _list1.Save();
            _list2 = new ContentList(TestWorkspace) { Name = "CtList2", AllowedChildTypes = new List<ContentType> { ContentType.GetByName("File") } };
            _list2.Save();

            //create content template folders
            var ctfSite = new SystemFolder(site) {Name = Repository.ContentTemplatesFolderName};
            ctfSite.Save();
            var ctfWs = new SystemFolder(TestWorkspace) { Name = Repository.ContentTemplatesFolderName };
            ctfWs.Save();
            var ctfList = new SystemFolder(_list1) { Name = Repository.ContentTemplatesFolderName };
            ctfList.Save();

            //create content template type folders
            var folderCtFile1 = new Folder(ctfSite) {Name = "File"};
            folderCtFile1.Save();

            var folderCtL1 = new Folder(ctfWs) { Name = "ContentList" };
            folderCtL1.Save();

            var folderCtFile2 = new Folder(ctfList) { Name = "File" };
            folderCtFile2.Save();

            //create content templates
            _fileTemplate1 = new File(folderCtFile1) {Name = _testFileName, Index = 10 };
            _fileTemplate1.Save();

            _fileTemplate2 = new File(folderCtFile2) { Name = _testFileName, Index = 20 };
            _fileTemplate2.Save();

            _listTemplate1 = new ContentList(folderCtL1) { Name = _testListTemplateName, Index = 10 };
            _listTemplate1.Save();
        }
コード例 #6
0
ファイル: SiteTest.cs プロジェクト: maxpavlov/FlexNet
 public void Site_SiteUrl_InsertWithDictionary()
 {
     var originalSite = new Site(Repository.Root);
     originalSite.UrlList = new Dictionary<string, string>(originalSite.UrlList) { { "mytestinterneturl2", "Forms" } };
     var originalSiteUrlList = originalSite.UrlList;
     originalSite.Save();
     var site = Node.Load<Site>(originalSite.Id);
     bool b = site.UrlList.Count == originalSiteUrlList.Count;
     originalSite.ForceDelete();
     Assert.IsTrue(b, "Site url list are NOT equal.");
 }
コード例 #7
0
ファイル: SiteTest.cs プロジェクト: maxpavlov/FlexNet
 public void Site_Constructor()
 {
     Node parent = Repository.Root; 
     Site target = new Site(parent);
     Assert.IsNotNull(target, "1. Site is null.");
 }
コード例 #8
0
        private static void CreateTestSite()
        {
            var node = Node.LoadNode(TestSitePath);
            if (node != null)
                return;

            var site = new Site(Repository.Root) { Name = TestSiteName };
            var urlList = new Dictionary<string, string>(3)
                              {
                                  {"localhost/fakesiteforms", "Forms"},
                                  {"localhost/fakesitewindows", "Windows"},
                                  {"localhost/fakesitenone", "None"}
                              };
            site.UrlList = urlList;
            site.Save();
        }
コード例 #9
0
ファイル: AppModelTest.cs プロジェクト: maxpavlov/FlexNet
        public static void CreateSandbox(TestContext testContext)
        {
            var site = Node.Load<Site>("/Root/TestSiteForAppModelTest");
            if (site == null)
            {
                site = new Site(Repository.Root);
                site.Name = "TestSiteForAppModelTest";
                var urlList = new Dictionary<string, string>();
                urlList.Add("testhost", "Windows");
                site.UrlList = urlList;
                site.Save();
            }
            var homePage = EnsureSiteStartPage(site);
            var webContent = Node.Load<GenericContent>("/Root/TestSiteForAppModelTest/Home/WebContent1");
            if (webContent == null)
            {
                webContent = new GenericContent(homePage, "WebContent");
                webContent.Name = "WebContent1";
                webContent.Save();
            }
            var file = Node.Load<File>("/Root/TestSiteForAppModelTest/Home/File1");
            if (file == null)
            {
                file = new File(homePage);
                file.Name = "File1";
                file.GetBinary("Binary").SetStream(Tools.GetStreamFromString("File1 content"));
                file.Save();
            }

            //---- Appmodel

            var siteAppsFolder = Node.Load<SystemFolder>("/Root/TestSiteForAppModelTest/(apps)");
            if (siteAppsFolder == null)
            {
                siteAppsFolder = new SystemFolder(site);
                siteAppsFolder.Name = "(apps)";
                siteAppsFolder.Save();
            }
            var siteAppsPageFolder = Node.Load<Folder>("/Root/TestSiteForAppModelTest/(apps)/Page");
            if (siteAppsPageFolder == null)
            {
                siteAppsPageFolder = new SystemFolder(siteAppsFolder);
                siteAppsPageFolder.Name = "Page";
                siteAppsPageFolder.Save();
            }
            var siteAppsPageBrowsePage = Node.Load<Page>("/Root/TestSiteForAppModelTest/(apps)/Page/Browse");
            if (siteAppsPageBrowsePage == null)
            {
                siteAppsPageBrowsePage = new Page(siteAppsPageFolder);
                siteAppsPageBrowsePage.Name = "Browse";
                siteAppsPageBrowsePage.GetBinary("Binary").SetStream(Tools.GetStreamFromString("<html><body><h1>Page Browse App</h1></body></html>"));
                siteAppsPageBrowsePage.Save();
            }
            var siteAppsPageEditPage = Node.Load<Page>("/Root/TestSiteForAppModelTest/(apps)/Page/Edit");
            if (siteAppsPageEditPage == null)
            {
                siteAppsPageEditPage = new Page(siteAppsPageFolder);
                siteAppsPageEditPage.Name = "Edit";
                siteAppsPageEditPage.GetBinary("Binary").SetStream(Tools.GetStreamFromString("<html><body><h1>Page EditPage</h1></body></html>"));
                siteAppsPageEditPage.Save();
            }

            var siteAppsGenericContentFolder = Node.Load<Folder>("/Root/TestSiteForAppModelTest/(apps)/GenericContent");
            if (siteAppsGenericContentFolder == null)
            {
                siteAppsGenericContentFolder = new SystemFolder(siteAppsFolder);
                siteAppsGenericContentFolder.Name = "GenericContent";
                siteAppsGenericContentFolder.Save();
            }
            var siteAppsGenericContentBrowsePage = Node.Load<Page>("/Root/TestSiteForAppModelTest/(apps)/GenericContent/Browse");
            if (siteAppsGenericContentBrowsePage == null)
            {
                siteAppsGenericContentBrowsePage = new Page(siteAppsGenericContentFolder);
                siteAppsGenericContentBrowsePage.Name = "Browse";
                siteAppsGenericContentBrowsePage.GetBinary("Binary").SetStream(Tools.GetStreamFromString("<html><body><h1>GenericContent Browse App</h1></body></html>"));
                siteAppsGenericContentBrowsePage.Save();
            }

            var siteAppsGenericContentEditPage = Node.Load<Page>("/Root/TestSiteForAppModelTest/(apps)/GenericContent/Edit");
            if (siteAppsGenericContentEditPage == null)
            {
                siteAppsGenericContentEditPage = new Page(siteAppsGenericContentFolder);
                siteAppsGenericContentEditPage.Name = "Edit";
                siteAppsGenericContentEditPage.GetBinary("Binary").SetStream(Tools.GetStreamFromString("<html><body><h1>GenericContent EditPage</h1></body></html>"));
                siteAppsGenericContentEditPage.Save();
            }


            //---- SelfDispatcher node
            var selfDispatcherContent = Node.Load<GenericContent>("/Root/TestSiteForAppModelTest/Home/SelfDispatcherContent1");
            if (selfDispatcherContent == null)
            {
                selfDispatcherContent = new GenericContent(homePage, "WebContent");
                selfDispatcherContent.Name = "SelfDispatcherContent1";
                selfDispatcherContent.BrowseApplication = Node.LoadNode("/Root/TestSiteForAppModelTest/(apps)/GenericContent/Edit");
                selfDispatcherContent.Save();
            }
        }
コード例 #10
0
ファイル: AppModelTest.cs プロジェクト: maxpavlov/FlexNet
 private void RemoveSiteStartPage(Site site)
 {
     if (site.StartPage == null)
         return;
     site.StartPage = null;
     site.Save();
 }
コード例 #11
0
ファイル: AppModelTest.cs プロジェクト: maxpavlov/FlexNet
        private static Page EnsureSiteStartPage(Site site)
        {
            var startPageName = "Home";
            var homePage = Node.Load<Page>(RepositoryPath.Combine(site.Path, startPageName));
            if (homePage == null)
            {
                homePage = new Page(site);
                homePage.Name = startPageName;
                homePage.GetBinary("Binary").SetStream(Tools.GetStreamFromString("<html><body><h1>TestPage</h1></body></html>"));
                homePage.Save();
                site.StartPage = homePage;
                site.Save();
            }
            else if(site.StartPage == null)
            {
                site.StartPage = homePage;
                site.Save();
            }

            return homePage;
        }