public void TestSystemTemplates() { FileStorage fs = new FileStorage ( Path.Combine (Path.GetTempPath (), "TestTemplatesService")); TemplatesService ts = new TemplatesService (fs); // Start service ts.Start (); ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider; // We must have at least one template provider called 'Default' Dashboard dash = ctp.Load ("Default dashboard"); Assert.AreNotSame (dash, null); // Test we dont have a template bool found = ctp.Exists ("NonExistingTemplate"); Assert.AreEqual (found, false); // Test saving the default template dash.Name = "NewDefault"; ctp.Save (dash); // Test loading a template from a file Dashboard newDefault = ctp.Load ("NewDefault"); Assert.AreEqual (newDefault.Name, "NewDefault"); }
public void TestSystemTemplates() { FileStorage fs = new FileStorage( Path.Combine(Path.GetTempPath(), "TestTemplatesService")); TemplatesService ts = new TemplatesService(fs); // Start service ts.Start(); ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider; // We must have at least one template provider called 'Default' Dashboard dash = ctp.Load("Default dashboard"); Assert.AreNotSame(dash, null); // Test we dont have a template bool found = ctp.Exists("NonExistingTemplate"); Assert.AreEqual(found, false); // Test saving the default template dash.Name = "NewDefault"; ctp.Save(dash); // Test loading a template from a file Dashboard newDefault = ctp.Load("NewDefault"); Assert.AreEqual(newDefault.Name, "NewDefault"); }
public void TestCopyOverwrite() { TemplatesService ts = new TemplatesService(storage); ts.Start(); ITeamTemplatesProvider teamtemplateprovider = ts.TeamTemplateProvider; LMTeam teamB = LMTeam.DefaultTemplate(5); teamB.Name = "B"; teamB.TeamName = "Template B"; teamB.FormationStr = "1-4"; teamB.List [0].Name = "Paco"; teamtemplateprovider.Save(teamB); LMTeam teamA = new LMTeam(); teamA.Name = "A"; teamA.TeamName = "Template A"; teamA.FormationStr = "1-4-3-3"; teamtemplateprovider.Save(teamA); LMTeam auxdelete = teamA; teamtemplateprovider.Copy(teamB, "A"); teamtemplateprovider.Delete(auxdelete); teamA = teamtemplateprovider.Templates [0] as LMTeam; Assert.AreEqual(4, teamtemplateprovider.Templates.Count); Assert.AreEqual("A", teamA.Name); Assert.AreEqual("Template B", teamA.TeamName); Assert.AreEqual(teamB.List.Count, teamA.List.Count); Assert.AreEqual("1-4", teamA.FormationStr); Assert.AreEqual("Paco", teamA.List [0].Name); }
public void TemplatesProvider_CopyStaticTemplate_CopyIsNotStatic() { // Arrange TemplatesService ts = new TemplatesService(storage); ts.Start(); ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider; Dashboard dash = ctp.Templates [0]; // Action ctp.Copy(dash, "NEW"); // Assert Assert.IsTrue(dash.Static); Dashboard dash2 = ctp.Templates.Where(t => t.Name == "NEW").First(); Assert.IsFalse(dash2.Static); }
public void TestSystemTemplates() { TemplatesService ts = new TemplatesService(storage); // Start service ts.Start(); ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider; // We must have at least one template provider called 'Default' Dashboard dash = ctp.Templates [0]; Assert.IsNotNull(dash); // Test we dont have a template Assert.IsFalse(ctp.Exists("NonExistingTemplate")); ITeamTemplatesProvider ttp = ts.TeamTemplateProvider; Assert.AreEqual(2, ttp.Templates.Count); // Test we dont have a template Assert.IsFalse(ctp.Exists("NonExistingTemplate")); }
public void TestSystemTemplates() { TemplatesService ts = new TemplatesService (storage); // Start service ts.Start (); ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider; // We must have at least one template provider called 'Default' Dashboard dash = ctp.Templates [0]; Assert.IsNotNull (dash); // Test we dont have a template Assert.IsFalse (ctp.Exists ("NonExistingTemplate")); ITeamTemplatesProvider ttp = ts.TeamTemplateProvider; Assert.AreEqual (2, ttp.Templates.Count); // Test we dont have a template Assert.IsFalse (ctp.Exists ("NonExistingTemplate")); }
public void TestCopyOverwrite() { TemplatesService ts = new TemplatesService (storage); ts.Start (); ITeamTemplatesProvider teamtemplateprovider = ts.TeamTemplateProvider; SportsTeam teamB = SportsTeam.DefaultTemplate (5); teamB.Name = "B"; teamB.TeamName = "Template B"; teamB.FormationStr = "1-4"; teamB.List [0].Name = "Paco"; teamtemplateprovider.Save (teamB); SportsTeam teamA = new SportsTeam (); teamA.Name = "A"; teamA.TeamName = "Template A"; teamA.FormationStr = "1-4-3-3"; teamtemplateprovider.Save (teamA); SportsTeam auxdelete = teamA; teamtemplateprovider.Copy (teamB, "A"); teamtemplateprovider.Delete (auxdelete); teamA = teamtemplateprovider.Templates [0]; Assert.AreEqual (4, teamtemplateprovider.Templates.Count); Assert.AreEqual ("A", teamA.Name); Assert.AreEqual ("Template B", teamA.TeamName); Assert.AreEqual (teamB.List.Count, teamA.List.Count); Assert.AreEqual ("1-4", teamA.FormationStr); Assert.AreEqual ("Paco", teamA.List [0].Name); }