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 ToToPersonRelationTypeArray_NoSpouse_ReturnsEmpty( [ValueSource("AllMaritalStates")] char maritalStatus) { var civilStates = AllMaritalStates.Select(c => new CivilStatusStub() { SpousePNR = 0, MaritalStatus = c } as CivilStatus).ToArray(); var result = CivilStatusWrapper.ToPersonRelationTypeArray(null, civilStates, UuidMap.CprStringToUuid, maritalStatus, maritalStatus, maritalStatus, maritalStatus, false); Assert.AreEqual(0, result.Length); }
public void ToToPersonRelationTypeArray_CorrectStatus_Returns2( [ValueSource("AllMaritalStates")] char maritalStatus) { var civilStates = AllMaritalStates.Select(c => new CivilStatusStub() { SpousePNR = Utilities.RandomCprNumber(), MaritalStatus = c } as CivilStatus).ToArray(); var result = CivilStatusWrapper.ToPersonRelationTypeArray(null, civilStates, UuidMap.CprStringToUuid, maritalStatus, maritalStatus, maritalStatus, maritalStatus, false); // 2 are expected because of upper and lower cases Assert.AreEqual(2, result.Length); }
public void ToPersonRelationTypeArray_DeadNoPnr_Empty( [ValueSource(typeof(Utilities), "AlphabetChars")] char deadCivilStatus ) { var civil = new CurrentCivilStatusType() { CivilStatusCode = deadCivilStatus, CivilStatusStartDate = DateTime.Today }; var ret = CivilStatusWrapper.ToPersonRelationTypeArray(civil, null, pnr => Guid.NewGuid(), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), Utilities.RandomSingleChar(Utilities.AlphabetChars, deadCivilStatus), deadCivilStatus, false); Assert.IsEmpty(ret); }
public void ToPersonRelationTypeArray_UnMarried_CorrectEndDate( [ValueSource(typeof(Utilities), "AlphabetChars")] char endedCivilStatus ) { var civil = new CurrentCivilStatusType() { CivilStatusCode = endedCivilStatus, CivilStatusStartDate = DateTime.Today, SpousePNR = Utilities.RandomCprNumberString() }; var ret = CivilStatusWrapper.ToPersonRelationTypeArray(civil, null, pnr => Guid.NewGuid(), Utilities.RandomSingleChar(Utilities.AlphabetChars, endedCivilStatus), endedCivilStatus, Utilities.RandomSingleChar(Utilities.AlphabetChars, endedCivilStatus), endedCivilStatus, false); Assert.AreEqual(DateTime.Today, ret[0].Virkning.TilTidspunkt.ToDateTime()); }
public void ToPersonRelationTypeArray_UnMarried_NullStartDate( [ValueSource(typeof(Utilities), "AlphabetChars")] char endedCivilStatus, [Values(true, false)] bool sameGenderForDead ) { var civil = new CurrentCivilStatusType() { CivilStatusCode = endedCivilStatus, CivilStatusStartDate = DateTime.Today, SpousePNR = Utilities.RandomCprNumberString() }; var ret = CivilStatusWrapper.ToPersonRelationTypeArray(civil, null, pnr => Guid.NewGuid(), Utilities.RandomSingleChar(Utilities.AlphabetChars, endedCivilStatus), endedCivilStatus, Utilities.RandomSingleChar(Utilities.AlphabetChars, endedCivilStatus), endedCivilStatus, sameGenderForDead); Assert.Null(ret[0].Virkning.FraTidspunkt.ToDateTime()); }
public void ToToPersonRelationTypeArray_Null_ThrowsException() { CivilStatusWrapper.ToPersonRelationTypeArray(null, null, UuidMap.CprStringToUuid, 'U', 'G', 'W', 'D', false); }