public ICollection <ReferenceDate> Resolve(SSG_SearchRequestResponse source, Person destination, ICollection <ReferenceDate> referenceDates, ResolutionContext context) { List <ReferenceDate> dates = new List <ReferenceDate>(); if (source.SSG_Persons[0].Date1 != null) { ReferenceDate referenceDate = new ReferenceDate { Index = 0, Key = source.SSG_Persons[0].Date1Label, Value = new DateTimeOffset((DateTime)source.SSG_Persons[0].Date1) }; dates.Add(referenceDate); } if (source.SSG_Persons[0].Date2 != null) { ReferenceDate referenceDate = new ReferenceDate { Index = 1, Key = source.SSG_Persons[0].Date2Label, Value = new DateTimeOffset((DateTime)source.SSG_Persons[0].Date2) }; dates.Add(referenceDate); } return(dates); }
public void SSG_SearchRequest_should_map_to_Person_Agency_correctly() { SSG_SearchRequestResponse response = new SSG_SearchRequestResponse() { SSG_SearchRequests = new List <SSG_SearchRequest> { new SSG_SearchRequest { Agency = new SSG_Agency { AgencyCode = "FMEP" }, RequestDate = new DateTime(2001, 1, 1), PersonSoughtFirstName = "firstName", PersonSoughtMiddleName = "middleName", PersonSoughtLastName = "surname", PersonSoughtThirdGiveName = "thirdGivenName", PersonSoughtDateOfBirth = new DateTime(2001, 1, 1), PersonSoughtGender = GenderType.Male.Value, AgentFirstName = "agentFirstName", AgentLastName = "agentLastName", SearchReason = new SSG_SearchRequestReason { ReasonCode = "Other" }, OriginalRequestorReference = "originalRef", RequestPriority = RequestPriorityType.Rush.Value, PersonSoughtRole = PersonSoughtType.P.Value, MinsOpen = 100 } }.ToArray(), SSG_Persons = new List <SSG_Person> { new SSG_Person { FirstName = "personFirstName" } }.ToArray(), }; Person person = _mapper.Map <Person>(response); Assert.AreEqual("agentFirstName", person.Agency.Agent.FirstName); Assert.AreEqual("agentLastName", person.Agency.Agent.LastName); Assert.AreEqual(SearchReasonCode.Other, person.Agency.ReasonCode); Assert.AreEqual("originalRef", person.Agency.RequestId); Assert.AreEqual(RequestPriority.Rush, person.Agency.RequestPriority); Assert.AreEqual("firstName", person.FirstName); Assert.AreEqual("middleName", person.MiddleName); Assert.AreEqual(new DateTimeOffset(new DateTime(2001, 1, 1)), person.DateOfBirth); Assert.AreEqual(SoughtPersonType.PAYOR, person.Type); Assert.AreEqual("FMEP", person.Agency.Code); Assert.AreEqual(1, person.Agency.DaysOpen); Assert.AreEqual(1, person.ResponsePersons.Count); }
public void normal_SearchResponse_should_map_to_Person_correctly() { SSG_SearchRequestResponse response = new SSG_SearchRequestResponse() { SSG_BankInfos = new List <SSG_Asset_BankingInformation> { new SSG_Asset_BankingInformation { AccountNumber = "accountNumber" } }.ToArray(), SSG_Asset_Others = new List <SSG_Asset_Other> { new SSG_Asset_Other { Description = "other Asset" } }.ToArray(), SSG_Addresses = new List <SSG_Address> { new SSG_Address { AddressLine1 = "line1" } }.ToArray(), SSG_Aliases = new List <SSG_Aliase> { new SSG_Aliase { FirstName = "aliasFirstName" } }.ToArray(), SSG_Asset_ICBCClaims = new List <SSG_Asset_ICBCClaim> { new SSG_Asset_ICBCClaim { ClaimNumber = "claimNumber" } }.ToArray(), SSG_Asset_Vehicles = new List <SSG_Asset_Vehicle> { new SSG_Asset_Vehicle { PlateNumber = "vehiclePlatNumber" } }.ToArray(), SSG_Employments = new List <SSG_Employment> { new SSG_Employment { BusinessName = "employment" } }.ToArray(), SSG_Identifiers = new List <SSG_Identifier> { new SSG_Identifier { Identification = "identification" } }.ToArray(), SSG_Identities = new List <SSG_Identity> { new SSG_Identity { FirstName = "relatedPerson" } }.ToArray(), SSG_Noteses = new List <SSG_Notese> { new SSG_Notese { Description = "notes" } }.ToArray(), SSG_Persons = new List <SSG_Person> { new SSG_Person { FirstName = "personFirstName" } }.ToArray(), SSG_PhoneNumbers = new List <SSG_PhoneNumber> { new SSG_PhoneNumber { TelePhoneNumber = "phoneNumber" } }.ToArray(), SSG_SearchRequests = new List <SSG_SearchRequest> { new SSG_SearchRequest { Agency = new SSG_Agency { AgencyCode = "FMEP" } } }.ToArray(), SSG_Asset_Investments = new List <SSG_Asset_Investment> { new SSG_Asset_Investment { AccountNumber = "accountNumber" } }.ToArray(), SSG_Asset_WorkSafeBcClaims = new List <SSG_Asset_WorkSafeBcClaim> { new SSG_Asset_WorkSafeBcClaim { ClaimNumber = "claim" } }.ToArray(), SSG_SafetyConcernDetails = new List <SSG_SafetyConcernDetail> { new SSG_SafetyConcernDetail { Detail = "detail" } }.ToArray(), SSG_Asset_PensionDisablilitys = new List <SSG_Asset_PensionDisablility> { new SSG_Asset_PensionDisablility { AddressLine1 = "lin1" } }.ToArray(), SSG_Asset_RealEstatePropertys = new List <SSG_Asset_RealEstateProperty> { new SSG_Asset_RealEstateProperty { AddressLine1 = "lin1" } }.ToArray(), SSG_Emails = new List <SSG_Email> { new SSG_Email { Email = "email" } }.ToArray(), SSG_Electronicas = new List <SSG_Electronica> { new SSG_Electronica { SocialMediaAddress = "addr" } }.ToArray(), }; Person person = _mapper.Map <Person>(response); Assert.AreEqual(1, person.Names.Count); Assert.AreEqual(1, person.Identifiers.Count); Assert.AreEqual(1, person.Addresses.Count); Assert.AreEqual(1, person.Phones.Count); Assert.AreEqual(1, person.Investments.Count); Assert.AreEqual(1, person.RelatedPersons.Count); Assert.AreEqual(1, person.BankInfos.Count); Assert.AreEqual(1, person.Employments.Count); Assert.AreEqual(1, person.InsuranceClaims.Count); Assert.AreEqual(1, person.CompensationClaims.Count); Assert.AreEqual(1, person.Vehicles.Count); Assert.AreEqual(1, person.OtherAssets.Count); Assert.AreEqual(1, person.SafetyConcerns.Count); Assert.AreEqual(1, person.Pensions.Count); Assert.AreEqual(1, person.RealEstateProperties.Count); Assert.AreEqual(1, person.ResponseNotes.Count); Assert.AreEqual(1, person.ResponsePersons.Count); Assert.AreEqual(1, person.Emails.Count); Assert.AreEqual(1, person.SocialMedias.Count); }