public void test_revert() { Entry ent = new Entry(42, DateTime.Now, "Some Entry"); CalendarEvent evt = new CalendarEvent(Guid.NewGuid(), 42, "Some event"); Guid event_guid = Guid.NewGuid(); ActionCalendarEventCreate action = new ActionCalendarEventCreate(event_guid, evt); CampaignState state = new CampaignState(); action.apply(state, ent); action.revert(state, ent); Assert.AreEqual(state.events.events.Count, 0); Assert.AreEqual(state.events.active_events.Count, 0); }
public void test_apply() { Entry ent = new Entry(42, DateTime.Now, "Some Entry"); CalendarEvent evt = new CalendarEvent(Guid.NewGuid(), 42, "Some event"); Guid event_guid = Guid.NewGuid(); ActionCalendarEventCreate action = new ActionCalendarEventCreate(event_guid, evt); CampaignState state = new CampaignState(); action.apply(state, ent); Assert.AreEqual(state.events.events.Count, 1); Assert.IsTrue(state.events.events.ContainsKey(event_guid)); Assert.AreEqual(state.events.events[event_guid].name, "Some event"); Assert.IsFalse(ReferenceEquals(state.events.events[event_guid], evt)); Assert.AreEqual(state.events.active_events.Count, 1); Assert.IsTrue(state.events.active_events.Contains(event_guid)); }