Пример #1
0
        public void Add_DoesNotRaiseValidationFailedEvent_WhenCurrentEventHasTargetReferenceEvent()
        {
            //Arrange
            var completedEvent = new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.AttendedOutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 20)
            };
            var cancerPeriod = new CancerPeriod();

            cancerPeriod.Add(new ClockStartingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.ReferralReceived
                }, EventDate = new DateTime(2014, 5, 6)
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.ReferralReview
                }, EventDate = new DateTime(2014, 5, 10)
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.BookedOutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 12)
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.OutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 14)
            });
            cancerPeriod.Add(completedEvent);

            var eventMilestone = new EventMilestone {
                Name = new EventName {
                    Code = EventCode.OutcomedOutpatientFirstAppointment
                }
            };

            var eventRaised = false;

            cancerPeriod.ValidationFailed += delegate { eventRaised = true; };

            //Act
            cancerPeriod.MapEventMilestoneToCompletedEvent(completedEvent, eventMilestone, new EventName {
                Code = EventCode.AttendedOutpatientFirstAppointment, Description = "Attended Outpatient First Appointment"
            });

            //Assert
            Assert.IsFalse(eventRaised);
        }
Пример #2
0
        public void Add_RaisesValidationFailedEvent_WhenCurrentEventDoesNotHaveTargetReferenceEvent()
        {
            //Arrange
            var completedEvent = new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.AttendedOutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 20), Period = new RTT18WeekPeriod {
                    Pathway = new Pathway {
                        PPINumber = "ppi"
                    }, Name = "period 1"
                }
            };
            var cancerPeriod = new CancerPeriod();

            cancerPeriod.Add(new ClockStartingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.ReferralReceived
                }, EventDate = new DateTime(2014, 5, 6), Period = new RTT18WeekPeriod {
                    Pathway = new Pathway {
                        PPINumber = "ppi"
                    }, Name = "period 1"
                }
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.ReferralReview
                }, EventDate = new DateTime(2014, 5, 10), Period = new RTT18WeekPeriod {
                    Pathway = new Pathway {
                        PPINumber = "ppi"
                    }, Name = "period 1"
                }
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.BookedOutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 12), Period = new RTT18WeekPeriod {
                    Pathway = new Pathway {
                        PPINumber = "ppi"
                    }, Name = "period 1"
                }
            });
            cancerPeriod.Add(new ClockTickingCompletedEvent {
                Name = new EventName {
                    Code = EventCode.OutpatientFirstAppointment
                }, EventDate = new DateTime(2014, 5, 14), Period = new RTT18WeekPeriod {
                    Pathway = new Pathway {
                        PPINumber = "ppi"
                    }, Name = "period 1"
                }
            });

            var eventMilestone = new EventMilestone {
                Name = new EventName {
                    Code = EventCode.OutcomedOutpatientFirstAppointment
                }
            };

            var eventRaised = false;

            cancerPeriod.ValidationFailed += delegate { eventRaised = true; };

            //Act
            cancerPeriod.MapEventMilestoneToCompletedEvent(completedEvent, eventMilestone, new EventName {
                Code = EventCode.AttendedOutpatientFirstAppointment, Description = "Attended Outpatient First Appointment"
            });

            //Assert
            Assert.IsTrue(eventRaised);
        }