public void ParseBatch_ChangeExtract_AllHasStartRecord( [Range(0, 79)] int index) { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); Assert.NotNull(result[index].StartRecord); }
public void AAA() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var grouped = all .GroupBy( p => { var date = PartInterface.Strings.PersonNumberToDate(p.PersonInformation.PNR).Value; //DateTime? nameDate if (p.HistoricalName.Count() == 0) { var n = p.CurrentNameInformation; if (!n.NameStartDate.HasValue) { return("1-1 Null "); } if (n.NameStartDate.Value.Date == date) { return("1-2 Same Day "); } if ((date - n.NameStartDate.Value).TotalDays < 15) { return("1-3 2 Weeks or less"); } if ((date - n.NameStartDate.Value).TotalDays < 30) { return("1-3 Month or less"); } return("1-4 More than month"); } var h = p.HistoricalName.OrderBy(n => n.NameStartDate).First(); if (!h.NameStartDate.HasValue) { return("2-1 Null "); } if (h.NameStartDate.Value.Date == date) { return("2-2 Same Day "); } if ((date - h.NameStartDate.Value).TotalDays < 15) { return("2-3 2 Weeks or less"); } if ((date - h.NameStartDate.Value).TotalDays < 30) { return("2-3 Month or less "); } return("2-4 More than month"); }) .Select(g => new { Status = g.Key, Data = g.ToArray() }) .OrderBy(g => g.Status) .ToArray(); object o = ""; }
public void ToPersonRelationTypeArray_DeadWithPnr_NotEmpty( [ValueSource(typeof(Utilities), "AlphabetChars")] char deadCivilStatus ) { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var f = result.Where(r => r.CurrentCivilStatus.CivilStatusCode == 'D' || r.HistoricalCivilStatus.Where(c => c.CivilStatusCode == 'D').Count() > 0).ToArray(); var civil = new CurrentCivilStatusType() { CivilStatusCode = deadCivilStatus, CivilStatusStartDate = DateTime.Today, PNR = Utilities.RandomCprNumberString(), SpousePNR = Utilities.RandomCprNumberString() }; var ret1 = CivilStatusWrapper.ToPersonRelationTypeArray(civil, null, pnr => Guid.NewGuid(), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), deadCivilStatus, false ); var ret2 = CivilStatusWrapper.ToPersonRelationTypeArray(civil, null, pnr => Guid.NewGuid(), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), deadCivilStatus, true); Assert.AreEqual(1, ret1.Length + ret2.Length); }
public void RelatedPnrs_ConvertsOK(string pnr) { var individual = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE).Where(o => o.PersonInformation.PNR == pnr).First(); var relatedPnrs = individual.RelatedPnrs; Assert.NotNull(relatedPnrs); }
public void CheckAddresses() { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var groupings = result.GroupBy( person => new { //HasClearAddress = person.ClearWrittenAddress != null, ValidClearAddress = !person.ClearWrittenAddress.IsEmpty, // { related to each other } CurrentAddress = person.CurrentAddressInformation != null, // { related to each other } ContactAddress = person.ContactAddress != null, ForeignAddress = person.CurrentDepartureData != null, ValidForeignAddress = person.CurrentDepartureData != null && !person.CurrentDepartureData.IsEmpty, Status = person.PersonInformation.Status }) //.Where(person => !person.Key.ValidClearAddress && !person.Key.ValidForeignAddress) .OrderBy(g => g.Key.Status) .Select(g => new { Key = g.Key, Value = g.ToArray() }) .ToArray(); /* Findings * If ClearWrittenAddress is empty, then CurrentAddressInformation is null (and vice versa) * CurrentDepartureData can only contain value if CurrentAddressInformation is null * Both CurrentAddressInformation and CurrentDepartureData is null if Status is 50,60,70 0r 90 * CurrentDepartureData (if not null) never contains empty values */ var p = result .GroupBy(r => new { Empty = r.ClearWrittenAddress.IsEmpty }) .Select(g => new { Key = g.Key, Values = g.ToArray() }) .ToArray(); object o = ""; }
public override CprBroker.Schemas.Part.RegistreringType1 CreateXmlType(string pnr, PersonRegistration dbReg, Func <string, Guid> cpr2uuidFunc) { var sourceString = dbReg.SourceObjects.ToString(); IndividualResponseType individualResponse; if (sourceString.StartsWith("<guid>")) { Console.WriteLine("By Extract: {0}", pnr); var extractId = Strings.Deserialize <Guid>(sourceString); using (var extractDataContext = new ExtractDataContext(this.BrokerConnectionString)) { var extractItems = extractDataContext.ExtractItems.Where(ei => ei.PNR == pnr && ei.ExtractId == extractId).ToArray(); individualResponse = Extract.GetPersonFromLatestExtract(pnr, extractItems.AsQueryable(), CprBroker.Providers.CPRDirect.Constants.DataObjectMap); } } else { Console.WriteLine("By TCP: {0}", pnr); var responseData = Strings.Deserialize <string>(sourceString); individualResponse = new IndividualResponseType() { Contents = new string(' ', 28), Data = responseData }; individualResponse.FillFromFixedLengthString(individualResponse.Data, CprBroker.Providers.CPRDirect.Constants.DataObjectMap); individualResponse.SourceObject = individualResponse.Data; } Console.WriteLine("Converting person"); var reg = individualResponse.ToRegistreringType1(cpr2uuidFunc); return(reg); }
public void ToRegistreringType1_ConvertsOK(string pnr) { var individual = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE).Where(o => o.PersonInformation.PNR == pnr).First(); var registration = individual.ToRegistreringType1(nr => Guid.NewGuid()); Assert.NotNull(registration); }
protected override List <IAddressSource> GetHistorical(IndividualResponseType pers) { return(pers.HistoricalAddress.Where(a => a.CorrectionMarker == ' ').Select(a => a as IAddressSource) .Concat(pers.HistoricalDeparture.Where(d => d.CorrectionMarker == ' ').Select(d => d as IAddressSource)) .Concat(pers.HistoricalDisappearance.Where(d => d.CorrectionMarker == ' ').Select(d => d as IAddressSource)) .ToList()); }
public void GetFolkeregisterAdresseSource_Empty_Dummy() { var db = new IndividualResponseType(); var ret = db.GetFolkeregisterAdresseSource(true); Assert.IsInstanceOf <DummyAddressSource>(ret); }
public void LoadAll____() { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var groupings = result .Where(p => p.PersonInformation.PNR == "0708614319") .GroupBy(res => res.HistoricalCivilStatus.Count) .Select(g => new { Count = g.Key, Persons = g .Select(p => new { PNR = p.PersonInformation.PNR, Current = p.CurrentCivilStatus, History = p.HistoricalCivilStatus, Spouses = p.ToSpouses(cpr => Guid.NewGuid()), Partners = p.ToRegisteredPartners(cpr => Guid.NewGuid()) }) .ToArray() }) .ToArray(); object o = ""; }
public void LoadAll() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var ss = all .Where(p => p.ParentalAuthority.Count() > 0) .Select(p => p.ParentalAuthority.ToArray()) .ToArray(); object o = ""; }
public void LoadAll() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var ss = all .AsQueryable() .GroupBy(p => new { Value = p.PersonInformation.Birthdate.HasValue, Certain = p.PersonInformation.BirthdateUncertainty }) .Select(g => new { Value = g.Key.Value, Certainty = g.Key.Certain, Data = g.ToArray() }) .ToArray(); object dd = ""; }
public void LoadAll() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var ss = all .Where(p => p.Disempowerment != null) .Select(p => p.Disempowerment) .GroupBy(p => new { Type = p.GuardianRelationType, PNR = !string.IsNullOrEmpty(p.ToRelationPNR()) }) .Select(g => new { Type = g.Key.Type, PNR = g.Key.PNR, Data = g.ToArray() }) .ToArray(); object o = ""; }
public void GetFolkeregisterAdresseSource_ClearAddressWithEmptyDeparture_Dummy() { var db = new IndividualResponseType() { ClearWrittenAddress = new ClearWrittenAddressType() { MunicipalityCode = 0, PostCode = 12, StreetCode = 0 }, CurrentDepartureData = new CurrentDepartureDataType() };; var ret = db.GetFolkeregisterAdresseSource(true); Assert.IsInstanceOf <DummyAddressSource>(ret); }
public void GetFolkeregisterAdresseSource_ClearAddressAndAddress_Dummy() { var db = new IndividualResponseType() { ClearWrittenAddress = new ClearWrittenAddressType() { MunicipalityCode = 0, PostCode = 0, StreetCode = 0 }, CurrentAddressInformation = new CurrentAddressInformationType() }; var ret = db.GetFolkeregisterAdresseSource(true); Assert.IsInstanceOf <DummyAddressSource>(ret); }
public List <TInterface> GetObjects(IndividualResponseType pers) { var names = new List <TInterface>(); names.AddRange( GetHistorical(pers) .OrderBy(n => n.ToStartTS()) .ToArray()); var current = GetCurrent(pers); if (current != null) { names.Add(current); } return(names); }
public void ToTilstandListeType_NotNull() { var resp = new IndividualResponseType() { PersonInformation = new PersonInformationType() { Status = 1 }, CurrentCivilStatus = new CurrentCivilStatusType() { CivilStatusCode = 'U' } }; var result = resp.ToTilstandListeType(); Assert.NotNull(result); Assert.NotNull(result.CivilStatus); Assert.NotNull(result.LivStatus); Assert.Null(result.LokalUdvidelse); }
public void OOO() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var pnrs = all.Select(p => p.HistoricalName.ToArray()).OrderByDescending(p => p.Count()).ToArray(); var pnrs2 = all.Select(p => p.HistoricalCivilStatus.ToArray()).OrderByDescending(p => p.Count()).ToArray(); var pnrs3 = all.Select(p => p.HistoricalPNR.ToArray()).OrderByDescending(p => p.Count()).ToArray(); var pnrs4 = all.Select(p => p.HistoricalCitizenship.ToArray()).OrderByDescending(p => p.Count()).ToArray(); // First historical name (026) has reversed start and end times var person = GetPerson(); var his = person.HistoricalPNR.First(); var s = his.ToStartTS(); var e = his.ToEndTS(); var intervals = person.ToRegisterOplysningIntervalArray(); var registerOplysning = intervals.Select(i => i.ToRegisterOplysningType()).ToArray(); System.IO.File.WriteAllText(this.GetPNR() + ".txt", CprBroker.Utilities.Strings.SerializeObject(registerOplysning)); object o = ""; }
public void SSS() { var persons = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var ordered = persons.OrderByDescending(p => { var ret = 0; ret += p.HistoricalCivilStatus.Count; ret += p.HistoricalName != null ? 1 : 0; return(ret); }); var allLines = LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE) .Where(l => l.IntCode > 0 && l.IntCode < 99) .GroupBy(l => l.PNR) .Select(p => new { Lines = p.OrderBy(l => l.IntCode).Select(l => l.Contents).ToArray(), History = p.ToArray().Where(l => l.IntCode >= 22 && l.IntCode <= 30).Count() }) .OrderByDescending(p => p.History) .ToArray(); var mostHistory = allLines.First(); var o = ""; }
static Utilities() { var all = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); PNRs = all.Select(p => p.PersonInformation.PNR).OrderBy(p => p).ToArray(); var lines = new List <LineWrapper>(LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE)); StartLine = lines.First(); EndLine = lines.Last(); lines.Remove(StartLine); lines.Remove(EndLine); var groups = lines.GroupBy(l => l.PNR).ToArray(); PersonLineWrappers = groups.ToDictionary(g => g.Key, g => g.ToArray()); var extract = new Extract() { ExtractId = Guid.NewGuid(), ExtractDate = DateTime.Now, StartRecord = StartLine.Contents, EndRecord = EndLine.Contents, Filename = "", ImportDate = DateTime.Now, Ready = true, ProcessedLines = lines.Count }; var allItems = new List <ExtractItem>(); PersonExtractItems = groups.ToDictionary( g => g.Key, g => { var items = g.ToArray() .Select(l => l.ToExtractItem(extract.ExtractId, Constants.DataObjectMap, Constants.RelationshipMap, Constants.MultiRelationshipMap)) .ToArray(); extract.ExtractItems.AddRange(items); allItems.AddRange(items); return(items); } ); AllExtractItems = allItems.ToArray(); }
public void ParseBatch_ChangeExtract_AllShareEndRecord() { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); Assert.AreEqual(1, result.Select(ind => ind.EndRecord).Distinct().Count()); }
protected override List <INameSource> GetHistorical(IndividualResponseType pers) { return(pers.HistoricalName.Where(n => n.CorrectionMarker == ' ').Select(n => n as INameSource).ToList()); }
protected override IAddressSource GetCurrent(IndividualResponseType pers) { return(pers.GetFolkeregisterAdresseSource(false)); }
protected override bool TimeOfDayMatters(IndividualResponseType pers) { return(false); }
protected override bool ShouldHaveCurrent(IndividualResponseType pers) { return(CprBroker.Schemas.Util.Enums.IsActiveCivilRegistrationStatus(pers.PersonInformation.Status) && pers.PersonInformation.Status != 90); }
public static void Check_correlation_between_historical_data(IndividualResponseType person) { var registerOplysningIntervals = person.ToRegisterOplysningIntervalArray(); var registerOplysning = registerOplysningIntervals .Select( interval => interval.ToRegisterOplysningType() ) .ToArray(); Assert.GreaterOrEqual(registerOplysning.Length, 0); // We only want to cary out historical tests if historical records er present. if (registerOplysning.Length > 0) { /* * foreach (RegisterOplysningType interval in registerOplysning) * { * /* * We test if the address and end time attributes are set in any * of the intervals. */ /* * We have to cast the item object as the type CprBorgerType as * the type is not declared in the class. */ /* * CprBorgerType item = (CprBorgerType)interval.Item; * Assert.IsNotNull(item); * //Assert.IsNotNull(item.AdresseNoteTekst); // <- is null * //Assert.IsNotNull(item.FolkeregisterAdresse); // <- is null * Console.WriteLine(item.FolkeregisterAdresse); // nothing is printed * Console.WriteLine(item.AdresseNoteTekst); // prints out the object name * VirkningType virkning = interval.Virkning; * Assert.IsNotNull(virkning); * Assert.IsNotNull(virkning.TilTidspunkt); * } */ /* * TESTING IF NAME INTERVALS ARE CONNECTED */ /* * We initialize two lists to keep track of start and end dates. */ List <DateTime> startDates = new List <DateTime>(); List <DateTime> endDates = new List <DateTime>(); List <string> names = new List <string>(); var egenskaber = person.ToEgenskabIntervals(); if (egenskaber.Length > 1) { foreach (EgenskabInterval egenskab in egenskaber) { /* * Start and end dates are added to the lists. */ startDates.Add(egenskab.Name.ToStartTS().Value); DateTime?endTS = egenskab.Name.ToEndTS(); if (endTS != null) { endDates.Add(endTS.Value); } Console.WriteLine("Date: " + egenskab.Name.ToStartTS()); if (endTS != null) { Console.WriteLine("End date: " + endTS.Value); } Console.WriteLine("First name(s): " + egenskab.Name.FirstName_s); /* * At this point it would be expected to see the Middle name 'Fich' as that one appears in the data file. * But nothing is printed in any of the cases. */ Console.WriteLine("Middle name: " + egenskab.Name.MiddleName); Console.WriteLine("Last name: " + egenskab.Name.LastName); var test = egenskab.ToAndreAdresser(); names.Add(egenskab.Name.FirstName_s + egenskab.Name.MiddleName + egenskab.Name.LastName); } /* * We test if the names are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < names.Count; i++) { prev = names[i]; if (i > 0) { //Assert.AreNotEqual(prev, names[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF ADDRESS INTERVALS ARE CONNECTED */ /* * We initialize two lists to keep track of start and end dates. */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <string> addresses = new List <string>(); var histAddresses = person.HistoricalAddress; if (histAddresses.Count >= 1) { foreach (HistoricalAddressType addr in histAddresses) { /* * Start and end dates are added to the lists. */ startDates.Add(addr.ToStartTS().Value); DateTime?endTS = addr.ToEndTS().Value; if (endTS != null) { endDates.Add(endTS.Value); } Console.WriteLine("Address: " + addr.ToAddressPostalType().DistrictSubdivisionIdentifier + addr.ToAddressPostalType().StreetName + addr.ToAddressPostalType().StreetBuildingIdentifier); if (endTS != null) { Console.WriteLine("End date: " + endTS.Value); } addresses.Add(addr.ToAddressPostalType().DistrictSubdivisionIdentifier + addr.ToAddressPostalType().StreetName + addr.ToAddressPostalType().StreetBuildingIdentifier); } /* * We test if the addresses are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < names.Count; i++) { prev = names[i]; if (i > 0) { // Unnecessry condition that fails for Test PNR 0101980014 //Assert.AreNotEqual(prev, names[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF CIVIL STATUS INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <char> statuses = new List <char>(); var civStatuses = person.HistoricalCivilStatus; if (civStatuses.Count >= 1) { foreach (HistoricalCivilStatusType status in civStatuses) { statuses.Add(status.CivilStatusCode); startDates.Add(status.CivilStatusStartDate.Value); endDates.Add(status.CivilStatusEndDate.Value); } /* * We test if the statuses are different. If not there is likely some info not being retrieved. */ char prev = '0'; for (int i = 0; i < statuses.Count; i++) { prev = statuses[i]; if (i > 0) { Assert.AreNotEqual(prev, statuses[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF CIVIL STATUS INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <char> informations = new List <char>(); var chInformations = person.HistoricalChurchInformation; if (chInformations.Count >= 1) { foreach (HistoricalChurchInformationType info in chInformations) { informations.Add(info.ChurchRelationship); startDates.Add(info.StartDate.Value); endDates.Add(info.EndDate.Value); } /* * We test if the statuses are different. If not there is likely some info not being retrieved. */ char prev = '0'; for (int i = 0; i < informations.Count; i++) { prev = informations[i]; if (i > 0) { Assert.AreNotEqual(prev, informations[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF CITIZENSHIP INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <string> countryCodes = new List <string>(); var hisCitizenships = person.HistoricalCitizenship; if (hisCitizenships.Count >= 1) { foreach (HistoricalCitizenshipType cship in hisCitizenships) { countryCodes.Add(cship.StringCountryCode); startDates.Add(cship.CitizenshipStartDate.Value); endDates.Add(cship.CitizenshipEndDate.Value); } /* * We test if the statuses are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < countryCodes.Count; i++) { prev = countryCodes[i]; if (i > 0) { Assert.AreNotEqual(prev, countryCodes[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF DEPARTURE INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <string> departures = new List <string>(); var hisDepartures = person.HistoricalDeparture; if (hisDepartures.Count >= 1) { foreach (HistoricalDepartureType departure in hisDepartures) { departures.Add( departure.EntryCountryCode.ToString() + departure.EntryDate + departure.ExitCountryCode + departure.ExitDate + departure.ForeignAddress1 + departure.ForeignAddress2 + departure.ForeignAddress3 + departure.ForeignAddress4 + departure.ForeignAddress5 ); if (departure.ToStartTS() != null) { startDates.Add(departure.ToStartTS().Value); } endDates.Add(departure.ToEndTS().Value); Console.WriteLine("Exit country: " + departure.ExitCountryCode); Console.WriteLine("Exit date: " + departure.ExitDate); Console.WriteLine("Entry country: " + departure.EntryCountryCode); Console.WriteLine("Entry date: " + departure.EntryDate); Console.WriteLine("Foregn addresses:"); Console.WriteLine("1: " + departure.ForeignAddress1); Console.WriteLine("2: " + departure.ForeignAddress2); Console.WriteLine("3: " + departure.ForeignAddress3); Console.WriteLine("4: " + departure.ForeignAddress4); Console.WriteLine("5: " + departure.ForeignAddress5); } /* * We test if the statuses are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < departures.Count; i++) { prev = departures[i]; if (i > 0) { Assert.AreNotEqual(prev, departures[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); endDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } /* * We also check if the end date of the latest occurance is connected * to the start date of the current address. */ Console.WriteLine("Last Addr date: " + endDates.Last()); if (person.GetFolkeregisterAdresseSource(false) != null) { Console.WriteLine("Cur Addr date: " + person.GetFolkeregisterAdresseSource(false).ToStartTS()); Assert.AreEqual(endDates.Last(), person.GetFolkeregisterAdresseSource(false).ToStartTS()); } } /* * TESTING IF DISAPPEARANCE INTERVALS ARE CONNECTED */ List <string> disappearances = new List <string>(); var hisDisappearances = person.HistoricalDisappearance; if (hisDisappearances.Count >= 1) { foreach (HistoricalDisappearanceType disappearance in hisDisappearances) { disappearances.Add( disappearance.DisappearanceDate.Value.ToString() + disappearance.RetrievalDate.Value.ToString() ); Console.WriteLine("Disappearance: " + disappearance.DisappearanceDate.Value.ToString()); Console.WriteLine("Retrieval: " + disappearance.RetrievalDate.Value.ToString()); } /* * We test if the disappearances/retrievals are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < disappearances.Count; i++) { prev = disappearances[i]; if (i > 0) { Assert.AreNotEqual(prev, disappearances[i]); } } /* * We DO NOT check if start and end dates are corresponding as they do not exist. */ } /* * TESTING IF SEPARATION INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <DateTime> separations = new List <DateTime>(); var hisSeparations = person.HistoricalSeparation; if (hisSeparations.Count >= 1) { foreach (HistoricalSeparationType separation in hisSeparations) { separations.Add(separation.ReferenceToAnyMaritalStatus.Value); startDates.Add(separation.SeparationStartDate.Value); endDates.Add(separation.SeparationEndDate.Value); Console.WriteLine("Marital status: " + separation.ReferenceToAnyMaritalStatus.Value); } /* * We test if the PNRs are different. If not there is likely some info not being retrieved. */ DateTime prev; for (int i = 0; i < separations.Count; i++) { prev = separations[i]; if (i > 0) { Assert.AreNotEqual(prev, separations[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } /* * TESTING IF CPR NUMBER INTERVALS ARE CONNECTED */ startDates = new List <DateTime>(); endDates = new List <DateTime>(); List <string> numbers = new List <string>(); var hisPNRs = person.HistoricalPNR; if (hisPNRs.Count >= 1) { foreach (HistoricalPNRType number in hisPNRs) { numbers.Add(number.OldPNR + number.PNR); startDates.Add(number.OldPNRStartDate.Value); endDates.Add(number.OldPNREndDate.Value); Console.WriteLine("Old number: " + number.OldPNR); Console.WriteLine("New number: " + number.PNR); } /* * We test if the PNRs are different. If not there is likely some info not being retrieved. */ string prev = ""; for (int i = 0; i < numbers.Count; i++) { prev = numbers[i]; if (i > 0) { Assert.AreNotEqual(prev, numbers[i]); } } /* * We check if start and end dates are corresponding. */ startDates.Sort(); for (int i = 0; i < startDates.Count; i++) { //We only check from the second point and forward as the start date of the first element will not be connected with anything. if (i > 0) { Console.WriteLine("Testing date: " + startDates[i]); CollectionAssert.Contains(endDates, startDates[i]); } } } } }
protected override IChurchInformation GetCurrent(IndividualResponseType pers) { return(pers.ChurchInformation); }
protected override INameSource GetCurrent(IndividualResponseType pers) { return(pers.CurrentNameInformation); }
public void ParseBatch_ChangeExtract_80Persons() { var result = IndividualResponseType.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); Assert.AreEqual(80, result.Count); }
protected override List <IChurchInformation> GetHistorical(IndividualResponseType pers) { return(pers.HistoricalChurchInformation.Select(c => c as IChurchInformation).ToList()); }