public void TestDelete() { bool eventEmitted = false; CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider(storage); Assert.AreEqual(1, provider.Templates.Count); // Template does not exists Assert.DoesNotThrow(() => provider.Delete(LMDashboard.DefaultTemplate(1))); // System template Assert.Throws <TemplateNotFoundException <Dashboard> > (() => provider.Delete(provider.Templates [0])); LMDashboard d = LMDashboard.DefaultTemplate(10); d.Name = "jamematen"; provider.Save(d); Assert.AreEqual(2, provider.Templates.Count); provider.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Remove && e.OldItems [0] == d) { eventEmitted = true; } }; provider.Delete(d); Assert.AreEqual(1, provider.Templates.Count); Assert.IsFalse(provider.Exists(d.Name)); Assert.IsTrue(eventEmitted); }
public void TestListTemplates() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider(storage); Assert.AreEqual(1, provider.Templates.Count); LMDashboard d = LMDashboard.DefaultTemplate(10); d.Name = "NEW"; provider.Save(d); Assert.AreEqual(2, provider.Templates.Count); }
public void TestExists() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider(storage); Assert.IsFalse(provider.Exists("ACANDEMOR")); LMDashboard d = LMDashboard.DefaultTemplate(10); d.Name = "NEW"; provider.Save(d); Assert.IsTrue(provider.Exists("NEW")); }
public void TestSaveUpdateLoad() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider(storage); LMDashboard d = LMDashboard.DefaultTemplate(10); d.Name = "jamematen"; provider.Save(d); Assert.IsTrue(provider.Exists("jamematen")); d = LMDashboard.DefaultTemplate(10); d.Name = "system"; provider.Register(d); Assert.IsNotNull(provider.Exists("system")); }
public void TestSaveUpdateLoad() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider (storage); DashboardLongoMatch d = DashboardLongoMatch.DefaultTemplate (10); d.Name = "jamematen"; provider.Save (d); Assert.IsTrue (provider.Exists ("jamematen")); d = DashboardLongoMatch.DefaultTemplate (10); d.Name = "system"; provider.Register (d); Assert.IsNotNull (provider.Exists ("system")); }
public void TestListTemplates() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider (storage); Assert.AreEqual (1, provider.Templates.Count); DashboardLongoMatch d = DashboardLongoMatch.DefaultTemplate (10); d.Name = "NEW"; provider.Save (d); Assert.AreEqual (2, provider.Templates.Count); }
public void TestExists() { CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider (storage); Assert.IsFalse (provider.Exists ("ACANDEMOR")); DashboardLongoMatch d = DashboardLongoMatch.DefaultTemplate (10); d.Name = "NEW"; provider.Save (d); Assert.IsTrue (provider.Exists ("NEW")); }
public void TestDelete() { bool eventEmitted = false; CategoriesTemplatesProvider provider = new CategoriesTemplatesProvider (storage); Assert.AreEqual (1, provider.Templates.Count); // Template does not exists Assert.DoesNotThrow (() => provider.Delete (DashboardLongoMatch.DefaultTemplate (1))); // System template Assert.Throws<TemplateNotFoundException<DashboardLongoMatch>> (() => provider.Delete (provider.Templates [0])); DashboardLongoMatch d = DashboardLongoMatch.DefaultTemplate (10); d.Name = "jamematen"; provider.Save (d); Assert.AreEqual (2, provider.Templates.Count); provider.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Remove && e.OldItems [0] == d) { eventEmitted = true; } }; provider.Delete (d); Assert.AreEqual (1, provider.Templates.Count); Assert.IsFalse (provider.Exists (d.Name)); Assert.IsTrue (eventEmitted); }