public void EventStatus_ReturnCorrectEventStatus_WhenEventTypeIsClockStoppingEvent() { //Arrange var completedEvent = new ClockStoppingCompletedEvent { Name = new EventName { Code = EventCode.PathwayCompletion }, EventDate = new DateTime(2014, 8, 10) }; //Act var result = completedEvent.EventStatus; //Assert Assert.AreEqual(EventStatus.Closed, result); }
public void Validate_DoesNotRaiseValidationFailedEvent_WhenClockStopsAndEventPathwayCompletion() { //Arrange var completedEvent = new ClockStoppingCompletedEvent { Name = new EventName { Code = EventCode.PathwayCompletion }, Period = new RTT18WeekPeriod { Name = "period 1", Pathway = new Pathway { PPINumber = "ppi" } } }; var eventRaised = false; completedEvent.ValidationFailed += delegate { eventRaised = true; }; //Act completedEvent.Validate(); //Assert Assert.IsFalse(eventRaised); }
public void Validate_RaisesValidationFailedEvent_WhenClockStopsAndEventOtherThanPathwayCompletion() { //Arrange var completedEvent = new ClockStoppingCompletedEvent { Name = new EventName { Code = EventCode.DiagnosticsOrderPlaced }, Period = new RTT18WeekPeriod { Name = "period 1", Pathway = new Pathway { PPINumber = "ppi" } } }; RuleViolation eventRaised = null; completedEvent.ValidationFailed += delegate { eventRaised = new RuleViolation(); }; //Act completedEvent.Validate(); //Assert Assert.IsNotNull(eventRaised); }
public void Validate_RaisesValidationFailedEvent_WhenClockStopsAndEventOtherThanInpatientDischarged() { //Arrange var completedEvent = new ClockStoppingCompletedEvent { Name = new EventName { Code = EventCode.PatientAddedToInpatientWaitingList }, Period = new RTT18WeekPeriod { Name = "period 1", Pathway = new Pathway { PPINumber = "ppi" } } }; var eventRaised = false; completedEvent.ValidationFailed += delegate { eventRaised = true; }; //Act completedEvent.Validate(); //Assert Assert.IsTrue(eventRaised); }
public void Validate_DoesNotRaiseValidationFailedEvent_WhenClockStopsAndEventOutpatientDischarged() { //Arrange var completedEvent = new ClockStoppingCompletedEvent { Name = new EventName { Code = EventCode.OutpatientDischarged }, Period = new RTT18WeekPeriod { Name = "period 1", Pathway = new Pathway { PPINumber = "ppi" } } }; RuleViolation eventRaised = null; completedEvent.ValidationFailed += delegate { eventRaised = new RuleViolation(); }; //Act completedEvent.Validate(); //Assert Assert.IsNull(eventRaised); }
public void PerTestSetup() { _clockStoppingCompletedEvent = new ClockStoppingCompletedEvent { EventDate = new DateTime(2000, 12, 25) }; }
private CompletedEvent BuildCompletedEvent(ClockType clockType, EventCode eventCode, DateTime eventDate, Period period) { CompletedEvent newCompletedEvent; if (eventCode == EventCode.PatientCancelEvent && period.IsSecondCancelByPatient(EventCode.PatientCancelEvent)) { newCompletedEvent = new ClockStoppingCompletedEvent(); } else { if (eventCode == EventCode.HospitalCancelEvent) { newCompletedEvent = new ClockTickingCompletedEvent(); } else { if (eventCode == EventCode.DidNotAttend && (period.IsSecondDidNotAttend(eventCode) && period.Pathway.Patient.IsChild(eventDate) || period.IsSecondDidNotAttend(eventCode) && period.AbleToNotAttendFirstEvent || !(period.Pathway.Patient.IsChild(eventDate) || period.AbleToNotAttendFirstEvent))) { newCompletedEvent = new ClockStoppingCompletedEvent(); } else { switch (clockType) { case ClockType.ClockStarting: { newCompletedEvent = new ClockStartingCompletedEvent(); break; } case ClockType.ClockTicking: { newCompletedEvent = new ClockTickingCompletedEvent(); break; } case ClockType.ClockPausing: { newCompletedEvent = new ClockPausingCompletedEvent(); break; } case ClockType.ClockStopping: { newCompletedEvent = new ClockStoppingCompletedEvent(); break; } default: { newCompletedEvent = new ClockTickingCompletedEvent(); break; } } } } } return(newCompletedEvent); }