public void Map_GivenWithCurrentDtosAndEditStatusAsNoop_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); dtoCollection.CurrentItems.Add(new AggregateCollectionMapperTestDto()); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> (dtoCollection); bool returnValue = aggregateRootCollectionMapper .FindCollectionEntity(requestHandler.AggregateRootFind) .MapRemovedItem(requestHandler.AggregateRootRemove) .MapChangedItem(requestHandler.AggregateRootChange) .MapAddedItem(requestHandler.AggregateRootAdd) .Map(); Assert.IsTrue(returnValue); Assert.IsTrue(dtoCollection.CurrentItems[0].DataErrorInfoCollection.Count() == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootFindMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootRemoveMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootChangeMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootAddMethodCalled == 0); }
public void Map_GivenWithCurrentDtosAndEditStatusAsUpdate_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Update }; dtoCollection.CurrentItems.Add(dto); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new List <AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity() }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem(requestHandler.AggregateNodeRemove) .MapChangedItem(requestHandler.AggregateNodeChange) .MapAddedItem(requestHandler.AggregateNodeAdd) .Map(); Assert.IsTrue(returnValue); Assert.IsTrue(dtoCollection.CurrentItems[0].DataErrorInfoCollection.Count() == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeRemoveMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeChangeMethodCalled > 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeAddMethodCalled == 0); }
public void Map_GivenWithCurrentDtosAndEditStatusAsCreateWithExceptionThrownByAddMethod_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Create }; dtoCollection.CurrentItems.Add(dto); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> (dtoCollection); bool returnValue = aggregateRootCollectionMapper .FindCollectionEntity(requestHandler.AggregateRootFind) .MapRemovedItem(requestHandler.AggregateRootRemoveWithThrowException) .MapChangedItem(requestHandler.AggregateRootChangeWithThrowException) .MapAddedItem(requestHandler.AggregateRootAddWithThrowException) .Map(); Assert.IsTrue(dtoCollection.CurrentItems[0].DataErrorInfoCollection.Count() > 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootFindMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootAddWithThrowExceptionMethodCalled > 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootChangeWithThrowExceptionMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateRootRemoveWithThrowExceptionMethodCalled == 0); Assert.IsFalse(returnValue); }
public void Map_GivenRemovedDtosWithMatchingKey_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add(new AggregateCollectionMapperTestDto()); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new List <AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity() }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem(requestHandler.AggregateNodeRemove) .Map(); Assert.IsTrue(returnValue); Assert.IsTrue(dtoCollection.RemovedItems[0].DataErrorInfoCollection.Count() == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeRemoveMethodCalled > 0); }
public void Map_GivenWithRemovedDtosWithExceptionThrownByRemoveMethod_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto(); dtoCollection.RemovedItems.Add(dto); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new List <AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity() }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem(requestHandler.AggregateNodeRemoveWithThrowException) .MapChangedItem(requestHandler.AggregateNodeChangeWithThrowException) .MapAddedItem(requestHandler.AggregateNodeAddWithThrowException) .Map(); Assert.IsTrue(dtoCollection.RemovedItems[0].DataErrorInfoCollection.Count() > 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeAddWithThrowExceptionMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeChangeWithThrowExceptionMethodCalled == 0); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeRemoveWithThrowExceptionMethodCalled > 0); Assert.IsFalse(returnValue); }
public void Map_GivenWithCurrentDtosAndEditStatusAsDelete_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Delete }; dtoCollection.CurrentItems.Add(dto); var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new List <AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity() }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem(requestHandler.AggregateNodeRemove) .MapChangedItem(requestHandler.AggregateNodeChange) .MapAddedItem(requestHandler.AggregateNodeAdd) .Map(); }
public void Map_GivenNoCurrentAndRemovedDtos_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> (dtoCollection); bool returnValue = aggregateRootCollectionMapper.Map(); Assert.IsTrue(returnValue); }
/// <summary> /// Handles the mapping. /// </summary> /// <param name="entity">The entity.</param> /// <returns>A <see cref="Rem.Ria.BillingModule.Web.PayorEditor.PayorPhoneNumbersDto"/></returns> protected override PayorPhoneNumbersDto HandleMapping(Payor entity) { var resultDtos = Mapper.Map <IList <PayorPhone>, IList <PayorPhoneDto> > (new List <PayorPhone> (entity.PhoneNumbers)); var responseDtos = new SoftDeleteObservableCollection <PayorPhoneDto> (resultDtos); var dto = new PayorPhoneNumbersDto { PhoneNumbers = responseDtos, Key = entity.Key }; return(dto); }
public void Map_GivenWithMultipleRemovedAndCurrentDtos_Succeeds() { int NoOfRemovedItems = 5; int NoOfAddedItems = 6; int NoOfUpdatedItems = 7; var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); for (int removedItemIndex = 0; removedItemIndex < NoOfRemovedItems; removedItemIndex++) { dtoCollection.RemovedItems.Add(new AggregateCollectionMapperTestDto()); } for (int addedItemIndex = 0; addedItemIndex < NoOfAddedItems; addedItemIndex++) { dtoCollection.CurrentItems.Add(new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Create }); } for (int updatedItemIndex = 0; updatedItemIndex < NoOfUpdatedItems; updatedItemIndex++) { dtoCollection.CurrentItems.Add(new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Update }); } var requestHandler = new AggregateCollectionMapperTestRequestHandler(); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new List <AggregateCollectionMapperTestAggregateNodeEntity> () { new AggregateCollectionMapperTestAggregateNodeEntity() }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem(requestHandler.AggregateNodeRemove) .MapChangedItem(requestHandler.AggregateNodeChange) .MapAddedItem(requestHandler.AggregateNodeAdd) .Map(); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeRemoveMethodCalled == NoOfRemovedItems); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeChangeMethodCalled == NoOfUpdatedItems); Assert.IsTrue(requestHandler.NoOfTimesAggregateNodeAddMethodCalled == NoOfAddedItems); Assert.IsTrue(returnValue); }
public void Map_GivenNullActionForFindCollectionEntity_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add(new AggregateCollectionMapperTestDto()); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> (dtoCollection); aggregateRootCollectionMapper .FindCollectionEntity(null) .Map(); }
private SoftDeleteObservableCollection <BloodPressureDto> GetBloodPressures(List <ResultDto> vitalSignResults, ref DateTime activityStartDate) { var bloodPressureDtos = new SoftDeleteObservableCollection <BloodPressureDto> (); var systolicBPResults = vitalSignResults.FindAll(vsr => vsr.ResultType.DisplayName == SystolicBP); var diastolicBPResults = vitalSignResults.FindAll(vsr => vsr.ResultType.DisplayName == DiastolicBP); var minCount = systolicBPResults.Count > diastolicBPResults.Count ? diastolicBPResults.Count : systolicBPResults.Count; if (minCount >= 1) { for (int i = 1; i <= minCount; i++) { SetActivityDate(systolicBPResults[i - 1], ref activityStartDate); var bloodPressureDto = CreateBloodPressureDto(systolicBPResults[i - 1], diastolicBPResults[i - 1]); if (bloodPressureDto != null) { bloodPressureDtos.Add(bloodPressureDto); } } } if (systolicBPResults.Count > minCount) { for (int i = minCount + 1; i <= systolicBPResults.Count; i++) { SetActivityDate(systolicBPResults[i - 1], ref activityStartDate); var bloodPressureDto = CreateBloodPressureDto(systolicBPResults[i - 1], null); if (bloodPressureDto != null) { bloodPressureDtos.Add(bloodPressureDto); } } } if (diastolicBPResults.Count > minCount) { for (int i = minCount + 1; i <= diastolicBPResults.Count; i++) { SetActivityDate(diastolicBPResults[i - 1], ref activityStartDate); var bloodPressureDto = CreateBloodPressureDto(null, diastolicBPResults[i - 1]); if (bloodPressureDto != null) { bloodPressureDtos.Add(bloodPressureDto); } } } return(bloodPressureDtos); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.PatientModule.Web.CdsRuleService.CdsRulesDto"/></returns> public CdsRulesDto CreateKeyedDto(long key) { var cdsRules = _sessionProvider.GetSession().QueryOver <CdsRule> ().List(); var cdsRuleDtos = Mapper.Map <IList <CdsRule>, IList <CdsRuleDto> > (cdsRules); var responseCdsRules = new SoftDeleteObservableCollection <CdsRuleDto> (cdsRuleDtos); var dto = new CdsRulesDto { CdsRules = responseCdsRules, Key = key }; return(dto); }
public void Map_GivenNoCurrentAndRemovedDtos_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new Mock <IEnumerable <AggregateCollectionMapperTestAggregateNodeEntity> > (); var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection.Object); bool returnValue = aggregateNodeCollectionMapper.Map(); Assert.IsTrue(returnValue); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key of the object.</param> /// <returns>A <see cref="Rem.Ria.BillingModule.Web.BillingOfficeEditor.BillingOfficePhonesDto"/></returns> public BillingOfficePhonesDto CreateKeyedDto(long key) { var entity = _sessionProvider.GetSession().Get <BillingOffice> (key); var resultDtos = Mapper.Map <IList <BillingOfficePhone>, IList <BillingOfficePhoneDto> > (new List <BillingOfficePhone> (entity.PhoneNumbers)); var responseDtos = new SoftDeleteObservableCollection <BillingOfficePhoneDto> (resultDtos); var dto = new BillingOfficePhonesDto { PhoneNumbers = responseDtos, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key of the object.</param> /// <returns>A <see cref="Rem.Ria.PatientModule.Web.PatientEditor.PatientAllergiesDto"/></returns> public PatientAllergiesDto CreateKeyedDto(long key) { var patient = _sessionProvider.GetSession().Get <Patient> (key); var allergiesDtos = Mapper.Map <IList <Allergy>, IList <AllergyDto> > (new List <Allergy> (patient.Allergies.Where(a => a.Provenance == null))); var responseAllergies = new SoftDeleteObservableCollection <AllergyDto> (allergiesDtos); var dto = new PatientAllergiesDto { Allergies = responseAllergies, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.AgencyModule.Web.Common.StaffIdentifiersDto"/></returns> public StaffIdentifiersDto CreateKeyedDto(long key) { var staff = _sessionProvider.GetSession().Get <Staff> (key); var staffIdentifierDtos = Mapper.Map <IList <StaffIdentifier>, IList <StaffIdentifierDto> > (new List <StaffIdentifier> (staff.Identifiers)); var responsePhones = new SoftDeleteObservableCollection <StaffIdentifierDto> (staffIdentifierDtos); var dto = new StaffIdentifiersDto { Identifiers = responsePhones, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.AgencyModule.Web.Common.AgencyContactsDto"/></returns> public AgencyContactsDto CreateKeyedDto(long key) { var agency = _sessionProvider.GetSession().Get <Agency> (key); var agencyContactDtos = Mapper.Map <IList <AgencyContact>, IList <AgencyContactDto> > (new List <AgencyContact> (agency.AgencyContacts)); var responseContacts = new SoftDeleteObservableCollection <AgencyContactDto> (agencyContactDtos); var dto = new AgencyContactsDto { AgencyContacts = responseContacts, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.AgencyModule.Web.Common.StaffAddressesDto"/></returns> public StaffAddressesDto CreateKeyedDto(long key) { var staff = _sessionProvider.GetSession().Get <Staff> (key); var staffAddressDtos = Mapper.Map <IList <StaffAddress>, IList <StaffAddressDto> > (new List <StaffAddress> (staff.Addresses)); var responseAddresses = new SoftDeleteObservableCollection <StaffAddressDto> (staffAddressDtos); var dto = new StaffAddressesDto { Addresses = responseAddresses, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key of the object.</param> /// <returns>A <see cref="Rem.Ria.PatientModule.Web.PatientEditor.PatientContactsDto"/></returns> public PatientContactsDto CreateKeyedDto(long key) { var patient = _sessionProvider.GetSession().Get <Patient> (key); var dtos = Mapper.Map <IList <PatientContact>, IList <PatientContactDto> > (new List <PatientContact> (patient.Contacts)); var responseDtos = new SoftDeleteObservableCollection <PatientContactDto> (dtos); var dto = new PatientContactsDto { Contacts = responseDtos, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key of the object.</param> /// <returns>A <see cref="Rem.Ria.PatientModule.Web.Common.PatientPhoneNumbersDto"/></returns> public PatientPhoneNumbersDto CreateKeyedDto(long key) { var patient = _sessionProvider.GetSession().Get <Patient> (key); var patientPhoneDtos = Mapper.Map <IList <PatientPhone>, IList <PatientPhoneDto> > (new List <PatientPhone> (patient.PhoneNumbers)); var responsePhones = new SoftDeleteObservableCollection <PatientPhoneDto> (patientPhoneDtos); var dto = new PatientPhoneNumbersDto { PhoneNumbers = responsePhones, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.AgencyModule.Web.Common.AgencyFaqsDto"/></returns> public AgencyFaqsDto CreateKeyedDto(long key) { var agency = _sessionProvider.GetSession().Get <Agency> (key); var agencyFaqDtos = Mapper.Map <IList <AgencyFrequentlyAskedQuestion>, IList <AgencyFaqDto> > ( new List <AgencyFrequentlyAskedQuestion> (agency.AgencyFrequentlyAskedQuestions)); var responseFaqs = new SoftDeleteObservableCollection <AgencyFaqDto> (agencyFaqDtos); var dto = new AgencyFaqsDto { AgencyFaqs = responseFaqs, Key = key }; return(dto); }
/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.AgencyModule.Web.Common.AgencyAddressesAndPhonesDto"/></returns> public AgencyAddressesAndPhonesDto CreateKeyedDto(long key) { var agency = _sessionProvider.GetSession().Get <Agency> (key); var agencyAddressDtos = Mapper.Map <IList <AgencyAddressAndPhone>, IList <AgencyAddressAndPhoneDto> > ( new List <AgencyAddressAndPhone> (agency.AddressesAndPhones)); var responseAddresses = new SoftDeleteObservableCollection <AgencyAddressAndPhoneDto> (agencyAddressDtos); var dto = new AgencyAddressesAndPhonesDto { AddressesAndPhones = responseAddresses, Key = key }; return(dto); }
public void Map_GivenNullActionForRemovedDto_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection <AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add(new AggregateCollectionMapperTestDto()); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity(); var aggregateNodeCollection = new Mock <IEnumerable <AggregateCollectionMapperTestAggregateNodeEntity> > (); var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection.Object); aggregateNodeCollectionMapper .MapRemovedItem(null) .Map(); }
/// <summary> /// Applies the soft delete observable collection change. /// </summary> /// <typeparam name="TProperty"> /// The type of the property. /// </typeparam> /// <typeparam name="TField"> /// The type of the field. /// </typeparam> /// <param name="field"> /// The field. /// </param> /// <param name="propertyExpression"> /// The property expression. /// </param> /// <param name="value"> /// The value. /// </param> public void ApplySoftDeleteObservableCollectionChange <TProperty, TField> ( ref SoftDeleteObservableCollection <TField> field, Expression <Func <TProperty> > propertyExpression, SoftDeleteObservableCollection <TField> value) { if (field != null) { field.CollectionChanged -= NotifyCollectionChanged; } field = value; RaisePropertyChanged(propertyExpression); IsDirty = true; if (field != null) { field.CollectionChanged += NotifyCollectionChanged; } }
private SoftDeleteObservableCollection <HeartRateDto> GetHeartRates(List <ResultDto> vitalSignResults, ref DateTime activityStartDate) { var heartRateDtos = new SoftDeleteObservableCollection <HeartRateDto>(); var heartRateResults = vitalSignResults.FindAll(vsr => vsr.ResultType.DisplayName == HeartRate); foreach (var heartRateResult in heartRateResults) { SetActivityDate(heartRateResult, ref activityStartDate); if (heartRateResult.ResultValue != null && heartRateResult.ResultValue.PhysicalQuantity != null && !string.IsNullOrEmpty(heartRateResult.ResultValue.PhysicalQuantity.Value)) { var dto = new HeartRateDto() { BeatsPerMinuteMeasure = GetNullableIntValue(heartRateResult.ResultValue.PhysicalQuantity.Value) }; heartRateDtos.Add(dto); } } return(heartRateDtos); }
public void Map_GivenWithCurrentDtosAndEditStatusAsDelete_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Delete }; dtoCollection.CurrentItems.Add ( dto ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new List<AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity () }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection ); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem ( requestHandler.AggregateNodeRemove ) .MapChangedItem ( requestHandler.AggregateNodeChange ) .MapAddedItem ( requestHandler.AggregateNodeAdd ) .Map (); }
public void Map_GivenNoCurrentAndRemovedDtos_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new Mock<IEnumerable<AggregateCollectionMapperTestAggregateNodeEntity>> (); var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection.Object ); bool returnValue = aggregateNodeCollectionMapper.Map (); Assert.IsTrue ( returnValue ); }
/// <summary> /// Initializes a new instance of the <see cref="PatientContactContactInformationDto"/> class. /// </summary> public PatientContactContactInformationDto() { _phoneNumbers = new SoftDeleteObservableCollection<PatientContactPhoneDto> (); }
public void Map_GivenRemovedDtosWithMatchingKey_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add ( new AggregateCollectionMapperTestDto () ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> ( dtoCollection ); bool returnValue = aggregateRootCollectionMapper .FindCollectionEntity ( requestHandler.AggregateRootFind ) .MapRemovedItem ( requestHandler.AggregateRootRemove ) .Map (); Assert.IsTrue ( returnValue ); Assert.IsTrue ( dtoCollection.RemovedItems[ 0 ].DataErrorInfoCollection.Count () == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootFindMethodCalled > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootRemoveMethodCalled > 0 ); }
public void Map_GivenRemovedDtosWithNoMatchingKey_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add ( new AggregateCollectionMapperTestDto () ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new List<AggregateCollectionMapperTestAggregateNodeEntity> (); var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection ); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem ( requestHandler.AggregateNodeRemove ) .Map (); Assert.IsFalse ( returnValue ); Assert.IsTrue ( dtoCollection.RemovedItems[ 0 ].DataErrorInfoCollection.Count () > 0 ); }
public void Map_GivenWithRemovedDtosWithExceptionThrownByRemoveMethod_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto (); dtoCollection.RemovedItems.Add ( dto ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new List<AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity () }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection ); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem ( requestHandler.AggregateNodeRemoveWithThrowException ) .MapChangedItem ( requestHandler.AggregateNodeChangeWithThrowException ) .MapAddedItem ( requestHandler.AggregateNodeAddWithThrowException ) .Map (); Assert.IsTrue ( dtoCollection.RemovedItems[ 0 ].DataErrorInfoCollection.Count () > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeAddWithThrowExceptionMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeChangeWithThrowExceptionMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeRemoveWithThrowExceptionMethodCalled > 0 ); Assert.IsFalse ( returnValue ); }
public void Map_GivenWithCurrentDtosAndEditStatusAsUpdateWithExceptionThrownByChangeMethod_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Update }; dtoCollection.CurrentItems.Add ( dto ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> ( dtoCollection ); bool returnValue = aggregateRootCollectionMapper .FindCollectionEntity ( requestHandler.AggregateRootFind ) .MapRemovedItem ( requestHandler.AggregateRootRemoveWithThrowException ) .MapChangedItem ( requestHandler.AggregateRootChangeWithThrowException ) .MapAddedItem ( requestHandler.AggregateRootAddWithThrowException ) .Map (); Assert.IsTrue ( dtoCollection.CurrentItems[ 0 ].DataErrorInfoCollection.Count () > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootFindMethodCalled > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootAddWithThrowExceptionMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootChangeWithThrowExceptionMethodCalled > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootRemoveWithThrowExceptionMethodCalled == 0 ); Assert.IsFalse ( returnValue ); }
/// <summary> /// Initializes a new instance of the <see cref="LocationAddressAndPhoneDto"/> class. /// </summary> public LocationAddressAndPhoneDto() { _phoneNumbers = new SoftDeleteObservableCollection<LocationPhoneDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="PatientSearchResultDto"/> class. /// </summary> public PatientSearchResultDto() { Addresses = new SoftDeleteObservableCollection<PatientAddressDto> (); PhoneNumbers = new SoftDeleteObservableCollection<PatientPhoneDto>(); }
/// <summary> /// Initializes a new instance of the <see cref="PatientSearchResultDto"/> class. /// </summary> public PatientSearchResultDto() { Addresses = new SoftDeleteObservableCollection <PatientAddressDto> (); PhoneNumbers = new SoftDeleteObservableCollection <PatientPhoneDto>(); }
public void Map_GivenNullActionForRemovedDto_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add ( new AggregateCollectionMapperTestDto () ); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new Mock<IEnumerable<AggregateCollectionMapperTestAggregateNodeEntity>> (); var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection.Object ); aggregateNodeCollectionMapper .MapRemovedItem ( null ) .Map (); }
/// <summary> /// Initializes a new instance of the <see cref="VitalSignDto"/> class. /// </summary> public VitalSignDto() { _bloodPressures = new SoftDeleteObservableCollection<BloodPressureDto> (); _heartRates = new SoftDeleteObservableCollection<HeartRateDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="LocationOperationScheduleDto"/> class. /// </summary> public LocationOperationScheduleDto() { _locationWorkHours = new SoftDeleteObservableCollection<LocationWorkHourDto> (); IsDirty = false; }
/// <summary> /// Initializes a new instance of the <see cref="ClinicalCaseProfileDto"/> class. /// </summary> public ClinicalCaseProfileDto() { _signedComments = new SoftDeleteObservableCollection<ClinicalCaseSignedCommentDto> (); _specialInitiatives = new SoftDeleteObservableCollection<LookupValueDto> (); _priorityPopulations = new SoftDeleteObservableCollection<LookupValueDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="LocationProfileDto"/> class. /// </summary> public LocationProfileDto() { _emailAddresses = new SoftDeleteObservableCollection <LocationEmailAddressDto> (); }
public void Map_GivenWithMultipleRemovedAndCurrentDtos_Succeeds() { int NoOfRemovedItems = 5; int NoOfAddedItems = 6; int NoOfUpdatedItems = 7; var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); for ( int removedItemIndex = 0; removedItemIndex < NoOfRemovedItems; removedItemIndex++ ) { dtoCollection.RemovedItems.Add ( new AggregateCollectionMapperTestDto () ); } for ( int addedItemIndex = 0; addedItemIndex < NoOfAddedItems; addedItemIndex++ ) { dtoCollection.CurrentItems.Add ( new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Create } ); } for ( int updatedItemIndex = 0; updatedItemIndex < NoOfUpdatedItems; updatedItemIndex++ ) { dtoCollection.CurrentItems.Add ( new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Update } ); } var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new List<AggregateCollectionMapperTestAggregateNodeEntity> () { new AggregateCollectionMapperTestAggregateNodeEntity () }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection ); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem ( requestHandler.AggregateNodeRemove ) .MapChangedItem ( requestHandler.AggregateNodeChange ) .MapAddedItem ( requestHandler.AggregateNodeAdd ) .Map (); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeRemoveMethodCalled == NoOfRemovedItems ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeChangeMethodCalled == NoOfUpdatedItems ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeAddMethodCalled == NoOfAddedItems ); Assert.IsTrue ( returnValue ); }
public void Map_GivenNullActionForFindCollectionEntity_ThrowsArgumentException() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); dtoCollection.RemovedItems.Add ( new AggregateCollectionMapperTestDto () ); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> ( dtoCollection ); aggregateRootCollectionMapper .FindCollectionEntity ( null ) .Map (); }
/// <summary> /// Initializes a new instance of the <see cref="LocationOperationScheduleDto"/> class. /// </summary> public LocationOperationScheduleDto() { _locationWorkHours = new SoftDeleteObservableCollection <LocationWorkHourDto> (); IsDirty = false; }
public void Map_GivenNoCurrentAndRemovedDtos_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> ( dtoCollection ); bool returnValue = aggregateRootCollectionMapper.Map (); Assert.IsTrue ( returnValue ); }
/// <summary> /// Initializes a new instance of the <see cref="LocationAddressAndPhoneDto"/> class. /// </summary> public LocationAddressAndPhoneDto() { _phoneNumbers = new SoftDeleteObservableCollection <LocationPhoneDto> (); }
public void Map_GivenWithCurrentDtosAndEditStatusAsNoop_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); dtoCollection.CurrentItems.Add ( new AggregateCollectionMapperTestDto () ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRootCollectionMapper = new AggregateRootCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity> ( dtoCollection ); bool returnValue = aggregateRootCollectionMapper .FindCollectionEntity ( requestHandler.AggregateRootFind ) .MapRemovedItem ( requestHandler.AggregateRootRemove ) .MapChangedItem ( requestHandler.AggregateRootChange ) .MapAddedItem ( requestHandler.AggregateRootAdd ) .Map (); Assert.IsTrue ( returnValue ); Assert.IsTrue ( dtoCollection.CurrentItems[ 0 ].DataErrorInfoCollection.Count () == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootFindMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootRemoveMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootChangeMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateRootAddMethodCalled == 0 ); }
/// <summary> /// Initializes a new instance of the <see cref="AgencyAddressAndPhoneDto"/> class. /// </summary> public AgencyAddressAndPhoneDto() { _phoneNumbers = new SoftDeleteObservableCollection<AgencyPhoneDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="LabSpecimenDto"/> class. /// </summary> public LabSpecimenDto() { LabResults = new SoftDeleteObservableCollection<LabResultDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="LocationProfileDto"/> class. /// </summary> public LocationProfileDto() { _emailAddresses = new SoftDeleteObservableCollection<LocationEmailAddressDto> (); }
/// <summary> /// Initializes a new instance of the <see cref="AgencyAddressAndPhoneDto"/> class. /// </summary> public AgencyAddressAndPhoneDto() { _phoneNumbers = new SoftDeleteObservableCollection <AgencyPhoneDto> (); }
public void Map_GivenWithCurrentDtosAndEditStatusAsUpdate_Succeeds() { var dtoCollection = new SoftDeleteObservableCollection<AggregateCollectionMapperTestDto> (); var dto = new AggregateCollectionMapperTestDto { EditStatus = EditStatus.Update }; dtoCollection.CurrentItems.Add ( dto ); var requestHandler = new AggregateCollectionMapperTestRequestHandler (); var aggregateRoot = new AggregateCollectionMapperTestAggregateRootEntity (); var aggregateNodeCollection = new List<AggregateCollectionMapperTestAggregateNodeEntity> { new AggregateCollectionMapperTestAggregateNodeEntity () }; var aggregateNodeCollectionMapper = new AggregateNodeCollectionMapper <AggregateCollectionMapperTestDto, AggregateCollectionMapperTestAggregateRootEntity, AggregateCollectionMapperTestAggregateNodeEntity> ( dtoCollection, aggregateRoot, aggregateNodeCollection ); bool returnValue = aggregateNodeCollectionMapper .MapRemovedItem ( requestHandler.AggregateNodeRemove ) .MapChangedItem ( requestHandler.AggregateNodeChange ) .MapAddedItem ( requestHandler.AggregateNodeAdd ) .Map (); Assert.IsTrue ( returnValue ); Assert.IsTrue ( dtoCollection.CurrentItems[ 0 ].DataErrorInfoCollection.Count () == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeRemoveMethodCalled == 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeChangeMethodCalled > 0 ); Assert.IsTrue ( requestHandler.NoOfTimesAggregateNodeAddMethodCalled == 0 ); }