public void OnBeforeTestsStarts()
        {
            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(pageNodeId, PlaceHolderId);

            ServerOperations.Events().CreateEvent(Event1Title, string.Empty, false, this.event1Start, this.event1End);
            var event1Item = EventsManager.GetManager().GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                                                  ni.Title == Event1Title).FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());

            ServerArrangementContext.GetCurrent().Values.Add("timezoneId", TimeZoneInfo.Utc.ToString());
        }
Exemplo n.º 2
0
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminEmail, AdminPass, true);

            ServerOperations.Pages().DeleteAllPages();
            ServerOperations.Templates().DeletePageTemplate(Template1Title);
            ServerOperations.Templates().DeletePageTemplate(Template2Title);

            string path1 = FeatherServerOperations.ResourcePackages().GetResourcePackagesDestination(Package1Name);

            FeatherServerOperations.ResourcePackages().DeleteDirectory(path1);

            string path2 = FeatherServerOperations.ResourcePackages().GetResourcePackagesDestination(Package2Name);

            FeatherServerOperations.ResourcePackages().DeleteDirectory(path2);
        }
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            string filePath         = FileInjectHelper.GetDestinationFilePath(this.gridPath);
            string templateFileCopy = FileInjectHelper.GetDestinationFilePath(this.newLayoutTemplatePath);
            string newFilePath      = FileInjectHelper.GetDestinationFilePath(this.newGridPath);

            File.Delete(filePath);
            File.Delete(templateFileCopy);
            File.Delete(newFilePath);

            ServerOperations.Pages().DeleteAllPages();
            ServerOperations.Templates().DeletePageTemplate(PageTemplateName);
            FeatherServerOperations.GridWidgets().RemoveGridControlFromToolboxesConfig(GridTitle);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(RegistrationPage, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddRegistrationWidgetToPage(pageId, PlaceHolderId);

            ServerOperations.Users().CreateUserWithProfileAndRoles(EditorUserEmail, EditorUserPassword, EditorUserFirstName, EditorUserLastName, new List <string> {
                "BackendUsers", "Administrators"
            });

            AuthenticationHelper.LogoutUser(this.AdminEmail);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            var blogId = ServerOperations.Blogs().CreateBlog(BlogTitle);

            ServerOperations.Blogs().CreatePublishedBlogPost(PostTitle, blogId);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);

            ServerOperations.Pages().CreatePage(PageTitle, templateId);

            var pageId     = ServerOperations.Pages().CreatePage(DetailPageTitle, templateId);
            var pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddBlogPostsWidgetToPage(pageNodeId, PlaceHolderId);
        }
        public void SetUp()
        {
            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            List <FormFieldType> formBodyControls = new List <FormFieldType>()
            {
                FormFieldType.TextField, FormFieldType.SubmitButton
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(formBodyControls, FormName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId, FormName);
        }
        /// <summary>
        /// Shares the page template with site.
        /// </summary>
        /// <param name="site">The site.</param>
        /// <param name="culture">The culture.</param>
        internal void SharePageTemplateWithSite(string site, string culture)
        {
            ServerOperations.Templates().SharePageTemplateWithSite(PageTemplateNameB, site);
            ServerOperations.Templates().SharePageTemplateWithSite(PageTemplateNameS, site);
            ServerOperations.Templates().SharePageTemplateWithSite(PageTemplateNameF, site);

            Guid templateIdB = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateNameB);
            Guid templateIdS = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateNameS);
            Guid templateIdF = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateNameF);

            var cultureInfo = new CultureInfo(culture);

            this.CreatePureMVCPageTemplate(PageTemplateNameB1, templateIdB, cultureInfo);
            this.CreatePureMVCPageTemplate(PageTemplateNameS1, templateIdS, cultureInfo);
            this.CreatePureMVCPageTemplate(PageTemplateNameF1, templateIdF, cultureInfo);
        }
        public void SetUp()
        {
            ServerOperations.News().CreatePublishedNewsItemLiveId(NewsTitle1, NewsContent, NewsAuthor, NewsSource);
            ServerOperations.News().CreatePublishedNewsItemLiveId(NewsTitle2, NewsContent, NewsAuthor, NewsSource);

            Guid searchIndexId = ServerOperations.Search().CreateSearchIndex(SearchIndexName, new[] { SearchContentType.News });

            ServerOperations.Search().Reindex(searchIndexId);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(SearchPageTitle, templateId);
            Guid newsPageId = ServerOperations.Pages().CreatePage(NewsPageTitle);

            ServerOperationsFeather.Pages().AddNewsWidgetToPage(newsPageId);
        }
Exemplo n.º 9
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            var blogId = ServerOperations.Blogs().CreateBlog(BlogTitle);

            ServerOperations.Blogs().CreatePublishedBlogPost(PostTitle, blogId);

            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageTitle, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddBlogPostsWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddLoginFormWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddLoginStatusWidgetToPage(pageId, PlaceHolderId);
            ServerOperations.Configuration().EnableUserPasswordReset();
        }
Exemplo n.º 10
0
        public void LayoutTemplates_RenameTemplateBasedOnLayoutFile_VerifyTemplateAndPage()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            string folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string filePath           = Path.Combine(folderPath, LayoutFileName);
            string templateRenamed    = "TemplateRenamed";
            string serverErrorMessage = "Server Error";

            try
            {
                FeatherServerOperations.ResourcePackages().AddNewResource(LayoutFileResource, filePath);
                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                Guid pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, PageTitle, PageUrl);

                string pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);
                Assert.IsTrue(pageContent.Contains(LayoutTemplateText), "Layout template text was not found in the page content");

                template.Title = templateRenamed;
                template.Name  = templateRenamed;
                pageManager.SaveChanges();

                Thread.Sleep(1000);

                pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);

                Assert.IsFalse(pageContent.Contains(serverErrorMessage), "Page throws a server error message");
                Assert.IsFalse(pageContent.Contains(LayoutTemplateText), "Layout template text was found in the page content");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(templateRenamed);
                File.Delete(filePath);
            }
        }
Exemplo n.º 11
0
        public void LayoutTemplates_CreateTemplateUsingTitleWithSpace_VerifyTemplateNotBasedOnLayoutFile()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            string folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string filePath      = Path.Combine(folderPath, LayoutFileName);
            string templateTitle = "   TestLayout";
            string page2         = "page2";

            try
            {
                FeatherServerOperations.ResourcePackages().AddNewResource(LayoutFileResource, filePath);
                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                Guid pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, PageTitle, PageUrl);

                string pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);
                Assert.IsTrue(pageContent.Contains(LayoutTemplateText), "Layout template text was not found in the page content");

                Guid templateId = FeatherServerOperations.Pages().CreatePureMvcTemplate(templateTitle);

                var template2 = pageManager.GetTemplates().Where(t => t.Id == templateId).FirstOrDefault();
                Assert.IsNotNull(template2, "Template was not found");

                Guid page2Id = FeatherServerOperations.Pages().CreatePageWithTemplate(template2, page2, page2);

                string page2Content = FeatherServerOperations.Pages().GetPageContent(page2Id);
                Assert.IsFalse(page2Content.Contains(LayoutTemplateText), "Layout template text was found in the page content");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(templateTitle);
                ServerOperations.Templates().DeletePageTemplate(TemplateTitle);
                File.Delete(filePath);
            }
        }
Exemplo n.º 12
0
        public void LayoutTemplates_CreateTemplateAndAddLayoutFilesUsingSpecialCharacters_VerifyTemplateBasedOnCorrectLayout()
        {
            string folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            string layout1Resource = "*****@*****.**";
            string layout2Resource = "Telerik.Sitefinity.Frontend.TestUtilities.Data.LayoutFilesSpecialChars.My_TestTemplate.cshtml";
            string layout1Name     = "*****@*****.**";
            string layout2Name     = "My_TestTemplate.cshtml";
            string template1Title  = "My@TestTemplate";
            string template2Title  = "My_TestTemplate";
            string layout1Text     = "My@TestTemplate";
            string layout2Text     = "My_TestTemplate";

            try
            {
                var  templateId = ServerOperations.Templates().CreatePureMVCPageTemplate(template1Title);
                Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);

                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                string file1Path = Path.Combine(folderPath, layout1Name);
                FeatherServerOperations.ResourcePackages().AddNewResource(layout1Resource, file1Path);

                string file2Path = Path.Combine(folderPath, layout2Name);
                FeatherServerOperations.ResourcePackages().AddNewResource(layout2Resource, file2Path);

                var nodeId      = ServerOperations.Pages().GetPageNodeId(pageId);
                var pageContent = FeatherServerOperations.Pages().GetPageContent(nodeId);
                Assert.IsTrue(pageContent.Contains(layout1Text), "Layout1 text was not found");
                Assert.IsFalse(pageContent.Contains(layout2Text), "Layout2 text is found, but it shouldn't be");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(template1Title);
                ServerOperations.Templates().DeletePageTemplate(template2Title);

                string file1Path = Path.Combine(folderPath, layout1Name);
                File.Delete(file1Path);

                string file2Path = Path.Combine(folderPath, layout2Name);
                File.Delete(file2Path);
            }
        }
        public void SetUp()
        {
            Guid templateIdSemantic = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateNameSemantic);

            Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageNameSemantic, templateIdSemantic);

            Guid templateIdFoundation = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateNameFoundation);

            Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageNameFoundation, templateIdFoundation);

            Guid mailingListId = Guid.NewGuid();
            Guid subscriberId  = Guid.NewGuid();

            ServerOperations.NewsLetter().CreateMailingList(mailingListId, MailingList, string.Empty, string.Empty, string.Empty);
            ServerOperations.NewsLetter().CreateSubscriber(subscriberId, SubscriberFirstName, SubscriberLastName, SubscriberEmail);
            ServerOperations.NewsLetter().AddSubscriberToMailingList(subscriberId, mailingListId);
        }
Exemplo n.º 14
0
        public void SetUp()
        {
            var fields = new FormFieldType[]
            {
                FormFieldType.CheckboxesField,
                FormFieldType.SubmitButton
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);
        }
Exemplo n.º 15
0
        public void SetUp()
        {
            string templateName = ServerArrangementContext.GetCurrent().Values["templateName"];

            Guid templateId   = ServerOperations.Templates().GetTemplateIdByTitle(templateName);
            Guid parentPageId = ServerOperations.Pages().CreatePage(PageName, templateId);
            Guid pageNodeId   = ServerOperations.Pages().GetPageNodeId(parentPageId);

            FeatherServerOperations.Pages().AddMvcWidgetToPage(pageNodeId, typeof(NavigationController).FullName, WidgetCaption, PlaceHolderId);

            Guid childPage1Id = Guid.NewGuid();

            ServerOperations.Pages().CreatePage(ChildPage1, childPage1Id, pageNodeId);
            Guid childPage2Id = Guid.NewGuid();

            ServerOperations.Pages().CreatePage(ChildPage2, childPage2Id, pageNodeId);
        }
Exemplo n.º 16
0
        public void AddNewLayoutFile()
        {
            AuthenticationHelper.AuthenticateUser(AdminEmail, AdminPass);

            PageManager manager        = PageManager.GetManager();
            int         templatesCount = manager.GetTemplates().Count();

            string filePath = FeatherServerOperations.ResourcePackages().GetResourcePackageDestinationFilePath(PackageName, LayoutFileName);

            FeatherServerOperations.ResourcePackages().AddNewResource(FileResource, filePath);

            FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);

            ServerOperations.Pages().CreatePage(PageTitle, templateId);
        }
        ////StoryId: 208384
        public void EditLayoutRoot_RequestPageBasedOnTemplate_ShouldLogCompilation()
        {
            PageNode pageNode         = null;
            var      layoutText       = @"@Html.SfPlaceHolder(""TestPlaceHolder"")	";
            var      layoutTextEdited = @"edited @Html.SfPlaceHolder(""TestPlaceHolder"") ";

            try
            {
                this.CreateLayoutFile(TestTemplateFileName);
                pageNode = this.CreatePageWithMvcWidget(TestTemplateTitle, TestPlaceholder);
                var fullPageUrl = RouteHelper.GetAbsoluteUrl(pageNode.GetUrl());
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                var viewPath       = "~/Frontend-Assembly/Telerik.Sitefinity.Frontend/Mvc/Views/Layouts/TestLayout.cshtml";
                var layoutFilePath = Path.Combine(HostingEnvironment.MapPath(LayoutsFolderRelativePath), TestTemplateFileName);
                FeatherServerOperations.ResourcePackages().EditLayoutFile(layoutFilePath, layoutText, layoutTextEdited);
                this.WaitForAspNetCacheToBeInvalidated(viewPath);

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                // Assert data
                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(1);

                var rootOperationId = this.GetRequestLogRootOperationId(fullPageUrl);

                var widgetCompilationText = "Compile view \"TestLayout.cshtml#Bootstrap.cshtml\" of controller \"" + typeof(GenericController).FullName + "\"";
                this.AssertViewCompilationParams(rootOperationId, viewPath, widgetCompilationText);

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(0);
            }
            finally
            {
                this.DeletePages(pageNode);
                ServerOperations.Templates().DeletePageTemplate(TestTemplateTitle);
                this.DeleteLayoutFile(TestTemplateFileName);
            }
        }
        public void SetUp()
        {
            var fields = new FormFieldType[]
            {
                FormFieldType.SubmitButton
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);
            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, "Test content", "Contentplaceholder1");
        }
Exemplo n.º 19
0
        public void LayoutTemplates_AddLayoutFileAndCreateNewTemplate_VerifyPageContent()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            string folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string filePath = Path.Combine(folderPath, LayoutFileName);

            try
            {
                FeatherServerOperations.ResourcePackages().AddNewResource(LayoutFileResource, filePath);
                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                ////Deleting the template in order to create new one with the same name
                ServerOperations.Templates().DeletePageTemplate(TemplateTitle);

                template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNull(template, "Template was found");

                ////Creating new template with the same title
                Guid templateId = FeatherServerOperations.Pages().CreatePureMvcTemplate(TemplateTitle);

                template = pageManager.GetTemplates().Where(t => t.Id == templateId).FirstOrDefault();
                Assert.IsNotNull(template, "New template was not found");

                Guid pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, PageTitle, PageUrl);

                string pageContent = FeatherServerOperations.Pages().GetPageContent(pageId);
                Assert.IsTrue(pageContent.Contains(LayoutTemplateText), "Layout template text was not found in the page content");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(TemplateTitle);
                File.Delete(filePath);
            }
        }
        public void CustomWidgetOnTemplate_EditView_ShouldLogCompilation()
        {
            var      viewRelativePath = "~/Mvc/Views/Test/Index.cshtml";
            PageNode pageNode         = null;
            Guid     templateId       = Guid.Empty;

            try
            {
                pageNode = this.CreatePageOnTemplateWithCustomWigdet(out templateId);
                var fullPageUrl = RouteHelper.GetAbsoluteUrl(pageNode.GetFullUrl());

                var viewContent = string.Empty;
                this.CreateView(viewRelativePath, viewContent);

                var viewPath = "~/Frontend-Assembly/FeatherWidgets.TestIntegration/Mvc/Views/Test/Index.cshtml";
                this.WaitForAspNetCacheToBeInvalidated(viewPath);

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(1);

                var rootOperationId       = this.GetRequestLogRootOperationId(fullPageUrl);
                var widgetCompilationText = "Compile view \"Index.cshtml#Bootstrap.cshtml\" of controller \"" + typeof(TestController).FullName + "\"";
                this.AssertViewCompilationParams(rootOperationId, viewPath, widgetCompilationText);

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(0);
            }
            finally
            {
                this.DeletePages(pageNode);
                this.DeleteView(viewRelativePath);
                if (templateId != Guid.Empty)
                {
                    ServerOperations.Templates().DeletePageTemplate(templateId);
                }
            }
        }
        public void DeleteMailingListAndPage()
        {
            ServerOperations.NewsLetter().DeleteAllSubscribers();
            ServerOperations.NewsLetter().DeleteAllMailingLists();
            ServerOperations.Pages().DeletePage(FirstPageName);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(SecondPageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, ContentBlockContent, PlaceHolderId);
            Guid secondMailingListId = Guid.NewGuid();
            Guid subscriberId        = Guid.NewGuid();

            ServerOperations.NewsLetter().CreateMailingList(secondMailingListId, SecondMailingList, string.Empty, string.Empty, string.Empty);
            ServerOperations.NewsLetter().CreateSubscriber(subscriberId, SubscriberFirstName, SubscriberLastName, SubscriberEmail);
            ServerOperations.NewsLetter().AddSubscriberToMailingList(subscriberId, secondMailingListId);
        }
        ////StoryId: 208384
        public void TemplateBasedOnNewLayout_RequestPage_ShouldLogRazorViewCompilation()
        {
            string   childTemplateTitle = "NewTestLayout";
            PageNode pageNode           = null;

            try
            {
                this.CreateLayoutFile(TestTemplateFileName);
                this.CreatePureMvcPageTemplate(childTemplateTitle, TestTemplateTitle);

                pageNode = this.CreatePageWithMvcWidget(childTemplateTitle, TestPlaceholder);
                var fullPageUrl = RouteHelper.GetAbsoluteUrl(pageNode.GetUrl());

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                var viewPath = "~/Frontend-Assembly/Telerik.Sitefinity.Frontend/Mvc/Views/Layouts/TestLayout.cshtml";

                // Assert data
                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(1);

                var rootOperationId       = this.GetRequestLogRootOperationId(fullPageUrl);
                var widgetCompilationText = "Compile view \"TestLayout.cshtml#Bootstrap.cshtml\" of controller \"" + typeof(GenericController).FullName + "\"";
                this.AssertViewCompilationParams(rootOperationId, viewPath, widgetCompilationText);

                this.ClearData();
                this.ExecuteAuthenticatedRequest(fullPageUrl);
                this.FlushData();

                this.AssertWidgetExecutionCount(1);
                this.AssertViewCompilationCount(0);
            }
            finally
            {
                this.DeletePages(pageNode);

                ServerOperations.Templates().DeletePageTemplate(childTemplateTitle);
                ServerOperations.Templates().DeletePageTemplate(TestTemplateTitle);

                this.DeleteLayoutFile(TestTemplateFileName);
            }
        }
Exemplo n.º 23
0
        public void SetUp()
        {
            string filePath = FileInjectHelper.GetDestinationFilePath(this.gridPath);

            Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            Stream destination = new FileStream(filePath, FileMode.Create, FileAccess.Write);

            var    assembly = FileInjectHelper.GetArrangementsAssembly();
            Stream source   = assembly.GetManifestResourceStream(FileResource);

            FileInjectHelper.CopyStream(source, destination);
            source.Close();
            destination.Close();

            FeatherServerOperations.GridWidgets().AddGridControlToToolboxesConfig(GridTitle, GridCss, GridVirtualPath);
            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
        }
Exemplo n.º 24
0
        public void LayoutTemplates_AddLayoutFileRenderingDateTime_VerifyTemplateNotRecompiled()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            var folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            try
            {
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                string filePath = Path.Combine(folderPath, DateTimeLayoutFile);

                FeatherServerOperations.ResourcePackages().AddNewResource(DateTimeLayoutResource, filePath);

                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == DateTimeTemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                Guid pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, PageTitle, PageUrl);

                FeatherServerOperations.Pages().GetPageContent(pageId);
                var recompCount = SystemMonitoring.GetRecompilationCount();

                Thread.Sleep(1000);

                FeatherServerOperations.Pages().GetPageContent(pageId);

                Assert.AreEqual(recompCount, SystemMonitoring.GetRecompilationCount(), "Unexpected recompilation happened.");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(DateTimeTemplateTitle);

                var filePath = Path.Combine(folderPath, DateTimeLayoutFile);
                File.Delete(filePath);
            }
        }
Exemplo n.º 25
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId, PlaceHolderId);

            var page2Id = ServerOperations.Pages().CreatePage(SpeciallPage);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page2Id, ContentBlockText);

            ServerOperations.Users().CreateUserWithProfileAndRoles(NewUserEmail, NewUserPassword, NewUserFirstName, NewUserLastName, new List <string> {
                "BackendUsers", "Administrators"
            });
            AuthenticationHelper.LogoutUser(this.AdminEmail);
        }
Exemplo n.º 26
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            string filePath = FileInjectHelper.GetDestinationFilePath(this.gridPath);

            Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            Stream destination = new FileStream(filePath, FileMode.Create, FileAccess.Write);

            var    assembly = FileInjectHelper.GetArrangementsAssembly();
            Stream source   = assembly.GetManifestResourceStream(FileResource);

            FileInjectHelper.CopyStream(source, destination);
            source.Close();
            destination.Close();

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
        }
Exemplo n.º 27
0
        public void OnBeforeTestsStarts()
        {
            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(pageNodeId, PlaceHolderId);

            var еventStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, DateTimeKind.Utc);
            var еventEndTime   = DateTime.Now.AddYears(5);

            ServerOperations.Events().CreаteAllDayRecurrentEvent(Event1Title, string.Empty, еventStartTime, еventEndTime, 1440, this.occurenceCount, 1, true);
            var event1Item = EventsManager.GetManager().GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                                                  ni.Title == Event1Title).FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());
            var еventExpectedStartTime = this.FormatTime(еventStartTime);

            ServerArrangementContext.GetCurrent().Values.Add("еventStartTime", еventExpectedStartTime);
        }
Exemplo n.º 28
0
        public void LayoutTemplates_AddNewLayoutFile_VerifyGeneratedTemplateAndCreatedPageContent()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            var folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            try
            {
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                string filePath = Path.Combine(folderPath, LayoutFileName);

                FeatherServerOperations.ResourcePackages().AddNewResource(LayoutFileResource, filePath);

                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                Guid pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, PageTitle, PageUrl);

                var page    = pageManager.GetPageNode(pageId);
                var pageUrl = page.GetFullUrl();
                pageUrl = RouteHelper.GetAbsoluteUrl(pageUrl);

                string pageContent = WebRequestHelper.GetPageWebContent(pageUrl);
                Assert.IsTrue(pageContent.Contains(LayoutTemplateText), "Layout template text was not found in the page content");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();
                ServerOperations.Templates().DeletePageTemplate(TemplateTitle);

                var filePath = Path.Combine(folderPath, LayoutFileName);
                File.Delete(filePath);
            }
        }
Exemplo n.º 29
0
        public void LayoutTemplates_RenameLayoutFile_VerifyNewGeneratedTemplate()
        {
            PageManager pageManager    = PageManager.GetManager();
            int         templatesCount = pageManager.GetTemplates().Count();

            string folderPath = Path.Combine(this.SfPath, "MVC", "Views", "Layouts");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string layoutFileNewName = "TestLayoutRenamed.cshtml";
            string newTemplateTitle  = "TestLayoutRenamed";

            string filePath    = Path.Combine(folderPath, LayoutFileName);
            string newFilePath = Path.Combine(folderPath, layoutFileNewName);

            try
            {
                FeatherServerOperations.ResourcePackages().AddNewResource(LayoutFileResource, filePath);
                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 1);

                var template = pageManager.GetTemplates().Where(t => t.Title == TemplateTitle).FirstOrDefault();
                Assert.IsNotNull(template, "Template was not found");

                File.Move(filePath, newFilePath);

                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 2);

                var newTemplate = pageManager.GetTemplates().Where(t => t.Title == newTemplateTitle).FirstOrDefault();
                Assert.IsNotNull(newTemplate, "Template was not found");
            }
            finally
            {
                ServerOperations.Templates().DeletePageTemplate(TemplateTitle);
                ServerOperations.Templates().DeletePageTemplate(newTemplateTitle);
                File.Delete(filePath);
                File.Delete(newFilePath);
            }
        }
Exemplo n.º 30
0
        public void OnBeforeTestsStarts()
        {
            var  templateId  = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid page1Id     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  page1NodeId = ServerOperations.Pages().GetPageNodeId(page1Id);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(page1NodeId, PlaceHolderId);

            var basicCurrentEventStartTime = DateTime.Now;
            var currentEventStartTime      = new DateTime(basicCurrentEventStartTime.Year, basicCurrentEventStartTime.Month, basicCurrentEventStartTime.Day, basicCurrentEventStartTime.Hour, basicCurrentEventStartTime.Minute, basicCurrentEventStartTime.Second);
            var basicCurrentEventEndTime   = DateTime.Now.AddHours(1);
            var currentEventEndTime        = new DateTime(basicCurrentEventEndTime.Year, basicCurrentEventEndTime.Month, basicCurrentEventEndTime.Day, basicCurrentEventEndTime.Hour, basicCurrentEventEndTime.Minute, basicCurrentEventEndTime.Second);

            ServerOperations.Events().CreateEvent(EventTitle, string.Empty, false, currentEventStartTime, currentEventEndTime);
            var currentEventItem = EventsManager.GetManager()
                                   .GetEvents()
                                   .Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ni.Title == EventTitle)
                                   .FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("currentEventId", currentEventItem.Id.ToString());
        }