public void CanProcessAProcessEndededEvent() { Guid guid = Guid.NewGuid(); Guid processType = ProcessGuids.ProcessA; ProcessStarted startEvent = new ProcessStarted(guid, processType); ProcessEnded endEvent = new ProcessEnded(guid, DateTime.UtcNow, false); IRepository<DailyActivity> repo = GetRepositoryForTest(); DailyActivityEventProcessor processor = new DailyActivityEventProcessor( repo ); processor.Handle(startEvent); processor.Handle(endEvent); DailyActivity activity = repo.Get(GetIdForFirstActivityPersisted(repo)); Assert.IsNotNull(activity); Assert.AreEqual(0, activity.ActiveProcesses); Assert.AreEqual(1, activity.TotalProcessCount); Assert.AreEqual(1, activity.CompletionCount); Assert.AreEqual(0, activity.CompletedWithErrorCount); }
public void CanCreateInstanceOfProcessEndedEvent() { Guid processId = Guid.NewGuid(); DateTime time = DateTime.UtcNow; bool withError = true; ProcessEnded @event = new ProcessEnded(processId, time, withError); Assert.IsNotNull(@event); Assert.IsInstanceOf<Event>(@event); Assert.AreEqual(processId, @event.ProcessId); Assert.AreEqual(time, @event.EndTime); Assert.AreEqual(withError, @event.WithError); }