public void CreateVisit_GivenValidArguments_CreatesVisit() { var visitRepository = new Mock<IVisitRepository> (); var visitStatus = new Mock<VisitStatus> (); visitStatus.SetupProperty ( v => v.WellKnownName, WellKnownNames.VisitModule.VisitStatus.Scheduled ); var visitStatusRepository = new Mock<IVisitStatusRepository> (); visitStatusRepository .Setup ( v => v.GetByWellKnownName ( WellKnownNames.VisitModule.VisitStatus.Scheduled ) ) .Returns ( visitStatus.Object ); var visitFactory = new VisitFactory ( visitRepository.Object, visitStatusRepository.Object ); var patient = new Mock<Patient> (); var clinicalCase = new Mock<ClinicalCase> (); clinicalCase.Setup ( c => c.Patient ).Returns ( patient.Object ); var agency = new Mock<Agency> (); var visitTemplate = new VisitTemplate( agency.Object, "Initial Behavioral Health - Adult", "99204" ); var staff = new Mock<Staff> (); var initialLocation = new Mock<Location> (); var appointmentDateTimeRange = new DateTimeRange ( new DateTime (), new DateTime () ); var visit = visitFactory.CreateVisit ( staff.Object, appointmentDateTimeRange, clinicalCase.Object, visitTemplate, initialLocation.Object ); Assert.IsNotNull ( visit ); }
public void CreateVisit_NullVisitTemplate_ThrowsNullReferenceException() { var visitRepository = new Mock<IVisitRepository> (); var visitStatus = new Mock<VisitStatus> (); visitStatus.SetupProperty ( v => v.WellKnownName, WellKnownNames.VisitModule.VisitStatus.Scheduled ); var visitStatusRepository = new Mock<IVisitStatusRepository> (); visitStatusRepository .Setup ( v => v.GetByWellKnownName ( WellKnownNames.VisitModule.VisitStatus.Scheduled ) ) .Returns ( visitStatus.Object ); var visitFactory = new VisitFactory ( visitRepository.Object, visitStatusRepository.Object ); var patient = new Mock<Patient> (); var clinicalCase = new Mock<ClinicalCase> (); clinicalCase.Setup ( c => c.Patient ).Returns ( patient.Object ); var initialLocation = new Mock<Location> (); var staff = new Mock<Staff> (); var appointmentDateTimeRange = new DateTimeRange ( new DateTime (), new DateTime () ); visitFactory.CreateVisit ( staff.Object, appointmentDateTimeRange, clinicalCase.Object, null, initialLocation.Object ); }