public void ExternalTemplateURISet() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.AreEqual(testData.ExpectedTemplateLibraryUri, master.TemplateLibraries.Libraries[0].Uri, "Library URI incorrect"); }
public void ExternalTemplateReferencesFound() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.IsTrue(master.TemplateLibraries.HasLibraries()); }
public void TemplateLoadStateInitiallyEmpty() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.IsTrue(master.TemplateLibraries.HasLibraries(), "No libraries defined"); Assert.IsFalse(master.TemplateLibraries.Libraries[0].Loaded, "Library incorrectly marked as loaded"); }
public void CustomTemplatesTagsRecognized() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.AreEqual(0, master.MasterCustomTagFactory.CustomTags.Count, "Custom tags not initially zero"); BasicLibrary testLib = new BasicLibrary(); TemplatesRoot library = master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); Assert.IsTrue(master.MasterCustomTagFactory.IsCustomTag("foo:bar")); Assert.IsTrue(master.MasterCustomTagFactory.IsCustomTag("foo:dog")); }
public void TemplateLibraryHasTag() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.Greater(testData.ExpectedCustomTags.Count, 0, "No expected tags"); BasicLibrary testLib = new BasicLibrary(); TemplatesRoot library = master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); Assert.AreEqual(2, library.CustomTags.Count, "Incorrect template count"); Assert.IsFalse(String.IsNullOrEmpty(library.CustomTags[0].Tag), "tag is empty"); }
public void ExternalTemplateCustomTagsRegistered() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.Greater(testData.ExpectedCustomTags.Count, 0, "No expected tags"); BasicLibrary testLib = new BasicLibrary(); master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); foreach (string tag in testData.ExpectedCustomTags) { Assert.IsTrue(master.MasterCustomTagFactory.IsCustomTag(tag), "Tag: " + tag + " is not registered with tag factory"); } }
public void CountCustomTemplates() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.AreEqual(0, master.MasterCustomTagFactory.CustomTags.Count, "Custom tags not initially zero"); Assert.IsFalse(master.NeedsReparse); BasicLibrary testLib = new BasicLibrary(); TemplatesRoot library = master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); int tcount = master.MasterCustomTagFactory.CustomTags.Count; Assert.Greater(master.MasterCustomTagFactory.CustomTags.Count, 0, "No Custom tags registered"); string result = master.RenderToString("canvas"); Assert.AreEqual(tcount, master.MasterCustomTagFactory.CustomTags.Count); }
public void TemplateLoadStateSetOn() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); Assert.IsTrue(master.TemplateLibraries.HasLibraries(), "No libraries defined"); Assert.IsFalse(master.TemplateLibraries.Libraries[0].Loaded, "Library incorrectly marked as loaded"); BasicLibrary testLib = new BasicLibrary(); master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); Assert.IsFalse(master.TemplateLibraries.HasLibraries(), "No libraries defined"); Assert.IsTrue(master.TemplateLibraries.Libraries[0].Loaded, "Library incorrectly marked as loaded"); Assert.IsFalse(string.IsNullOrEmpty(master.TemplateLibraries.Libraries[0].LibraryXml), "LibraryXml value not set on load"); }
public void RenderWithExternalTemplates() { GadgetReferencingTemplateLibrary testData = new GadgetReferencingTemplateLibrary(); GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source); //new GadgetMaster(ControlFactory.GetControlFactory(TEST_FACTORY_KEY)); BasicLibrary testLib = new BasicLibrary(); TemplatesRoot library = master.LoadTemplateLibrary(testData.ExpectedTemplateLibraryUri, BasicLibrary.Source); master.RenderingOptions.ClientRenderCustomTemplates = false; master.RenderingOptions.ClientRenderDataContext = false; master.RenderingOptions.DivWrapContentBlocks = false; master.RenderingOptions.SuppressWhitespace = true; master.ReParse(); ResolveDataControlValues(master.MyDataContext, testData.ExpectedViewer, testData.ExpectedViewer, testData.ExpectedFriends); string result = ControlTestHelper.NormalizeRenderResult(master.RenderToString("canvas")); result = result.Replace(" ", " "); string expected = ControlTestHelper.NormalizeRenderResult(testData.ExpectedCanvas); Assert.AreEqual(expected, result, "Rendered results don't match expected"); }