public void ModifyTemplateOk()
        {
            TemplatesOperationMockService mock           = new TemplatesOperationMockService();
            FileOperationMockService      mockFile       = new FileOperationMockService();
            TemplateController            controllerMock = new TemplateController(mock, mockFile);
            int countOld = mock.GetTemplates().Count;
            var added    = controllerMock.LoadTemplate("TemplateModified", mock.GetTemplates().FirstOrDefault().TemplateID, null);

            Assert.True(mock.GetTemplate("TemplateModified") != null);
        }
        public void AddTemplateOk()
        {
            TemplatesOperationMockService mock           = new TemplatesOperationMockService();
            FileOperationMockService      mockFile       = new FileOperationMockService();
            TemplateController            controllerMock = new TemplateController(mock, mockFile);
            int countOld = mock.GetTemplates().Count;
            var added    = controllerMock.LoadTemplate("TemplateNew", Guid.Empty, null);

            Assert.True(mock.GetTemplates().Count > countOld);
        }
Beispiel #3
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindData();
            if (_customizations.Count > 0)
            {
                GridView1.Visible         = false;
                lblCustomizeTemplate.Text = string.Format(Localization.GetString("CustomizeTemplate", LocalResourceFile),
                                                          GridView1.SelectedRow.Cells[1].Text,
                                                          GridView1.SelectedRow.Cells[2].Text);

                cmdApply.Visible = true;
            }
            else
            {
                TemplateController.LoadTemplate(HttpUtility.HtmlDecode(GridView1.SelectedRow.Cells[1].Text),
                                                ModuleContext.PortalId, ModuleContext.TabId);
                DeleteMe();
            }
        }
Beispiel #4
0
        protected void cmdApply_Click(object sender, EventArgs e)
        {
            XmlDocument doc = null;

            foreach (var customizedValue in _customizations)
            {
                var parentNode = customizedValue.Node.ParentNode;
                // ReSharper disable PossibleNullReferenceException
                if (customizedValue.ValueSource != string.Empty)
                {
                    ((XmlElement)parentNode).SetAttribute(customizedValue.ValueSource, customizedValue.Value);
                    ((XmlElement)parentNode).SetAttribute("installmode", "force");
                }
                else
                {
                    parentNode.InnerText = customizedValue.Value;
                }
                // ReSharper restore PossibleNullReferenceException
                doc = customizedValue.Node.OwnerDocument;
            }

            TemplateController.LoadTemplate(doc, ModuleContext.PortalId, ModuleContext.TabId);
            DeleteMe();
        }