public void AddingTestMethod() { EventCatalogSingleton eventCatalogSingleton = EventCatalogSingleton.Instance; eventCatalogSingleton.Events = new ObservableCollection <Event>(); eventCatalogSingleton.Add(new Event()); Assert.AreEqual(1, eventCatalogSingleton.Events.Count); }
private void CreateEvent() { if (string.IsNullOrWhiteSpace(EventTemplate.Name) || string.IsNullOrWhiteSpace(EventTemplate.Description) || string.IsNullOrWhiteSpace(EventTemplate.Place)) { return; } EventTemplate.Id = (int)(DateTime.Now - new DateTime(1970, 01, 01, 0, 0, 0)).TotalSeconds; EventTemplate.DateTime = new DateTime(Date.Year, Date.Month, Date.Day, Time.Hours, Time.Minutes, Time.Seconds); EventCatalogSingleton.Add(EventTemplate); CleanTemplate(); SortEvents(); }
public void EditTestMethod() { EventCatalogSingleton eventCatalogSingleton = EventCatalogSingleton.Instance; eventCatalogSingleton.Events = new ObservableCollection <Event>(); eventCatalogSingleton.Add(new Event() { Id = 0 }); Assert.AreEqual(1, eventCatalogSingleton.Events.Count); Assert.AreEqual(0, eventCatalogSingleton.Events[0].Id); eventCatalogSingleton.Update(0, new Event() { Id = 1 }); Assert.AreEqual(1, eventCatalogSingleton.Events[0].Id); }