public void Handle_GivenValidPatientInfo_ReturnsPatientDtoThatWasSavedInDB()
        {
            var patientRepository = new PatientRepository ( SessionProvider );
            var patientFactory = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator());
            var dtoToDomainMappingHelper = new DtoToDomainMappingHelper ( new LookupValueRepository ( SessionProvider ) );
            var handler = new CreateNewPatientRequestHandler(dtoToDomainMappingHelper, patientFactory)
                              {
                                  SessionProvider = SessionProvider
                              };

            // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request
            Request request = new CreateNewPatientRequest
                              {
                                  AgencyKey = SafeHarborAgency.Key,
                                  BirthDate = new DateTime ( 1983, 8, 29 ),
                                  FirstName = "John",
                                  Gender = new LookupValueDto
                                               {
                                                   WellKnownName = MaleGender.WellKnownName,
                                                   Key = MaleGender.Key,
                                                   Name = MaleGender.Name
                                               },
                                  LastName = "Smith",
                                  MiddleName = "Middle"
                              };

            var response = handler.Handle ( request ) as CreateNewPatientResponse;

            Assert.IsTrue ( response.PatientDto.Key > 0 );
        }
示例#2
0
        public void Handle_GivenValidPatientInfo_ReturnsPatientDtoThatWasSavedInDB()
        {
            var patientRepository        = new PatientRepository(SessionProvider);
            var patientFactory           = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator());
            var dtoToDomainMappingHelper = new DtoToDomainMappingHelper(new LookupValueRepository(SessionProvider));
            var handler = new CreateNewPatientRequestHandler(dtoToDomainMappingHelper, patientFactory)
            {
                SessionProvider = SessionProvider
            };

            // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request
            Request request = new CreateNewPatientRequest
            {
                AgencyKey = SafeHarborAgency.Key,
                BirthDate = new DateTime(1983, 8, 29),
                FirstName = "John",
                Gender    = new LookupValueDto
                {
                    WellKnownName = MaleGender.WellKnownName,
                    Key           = MaleGender.Key,
                    Name          = MaleGender.Name
                },
                LastName   = "Smith",
                MiddleName = "Middle"
            };

            var response = handler.Handle(request) as CreateNewPatientResponse;

            Assert.IsTrue(response.PatientDto.Key > 0);
        }
        public void Handle_GivenInValidPatientInfo_ThrowsException()
        {
            var patientRepository = new PatientRepository ( SessionProvider );
            var patientFactory = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator());
            var dtoToDomainMappingHelper = new DtoToDomainMappingHelper ( new LookupValueRepository ( SessionProvider ) );
            var handler = new CreateNewPatientRequestHandler ( dtoToDomainMappingHelper, patientFactory )
                              {
                                  SessionProvider = SessionProvider
                              };

            // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request
            Request request = new CreateNewPatientRequest
                                  {
                                      AgencyKey = SafeHarborAgency.Key
                                  };
            handler.Handle ( request );
        }
示例#4
0
        public void Handle_GivenInValidPatientInfo_ThrowsException()
        {
            var patientRepository        = new PatientRepository(SessionProvider);
            var patientFactory           = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator());
            var dtoToDomainMappingHelper = new DtoToDomainMappingHelper(new LookupValueRepository(SessionProvider));
            var handler = new CreateNewPatientRequestHandler(dtoToDomainMappingHelper, patientFactory)
            {
                SessionProvider = SessionProvider
            };

            // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request
            Request request = new CreateNewPatientRequest
            {
                AgencyKey = SafeHarborAgency.Key
            };

            handler.Handle(request);
        }