Ejemplo n.º 1
0
            public void Compose_ValidArray_CorrectTilTidspunkt(
                [ValueSource("PastDatesWithNull")] DateTime?fromDate)
            {
                var input  = FutureDates.Select(pd => VirkningType.Create(fromDate, pd)).ToArray();
                var result = VirkningType.Compose(input);

                Assert.AreEqual(FutureDates.Max(), result.TilTidspunkt.ToDateTime());
            }
Ejemplo n.º 2
0
            public void Compose_ValidArray_CorrectFraTidspunkt(
                [ValueSource("FutureDatesWithNull")] DateTime?toDate)
            {
                var input  = PastDates.Select(pd => VirkningType.Create(pd, toDate)).ToArray();
                var result = VirkningType.Compose(input);

                Assert.AreEqual(PastDates.Min(), result.FraTidspunkt.ToDateTime());
            }
Ejemplo n.º 3
0
            public void Compose_ValidSingle_TilTidspunktEqualsInput(
                [ValueSource("PastDatesWithNull")] DateTime?fromDate,
                [ValueSource("FutureDatesWithNull")] DateTime?toDate)
            {
                var virkning = VirkningType.Create(fromDate, toDate);
                var result   = VirkningType.Compose(virkning);

                Assert.AreEqual(virkning.TilTidspunkt.ToDateTime(), result.TilTidspunkt.ToDateTime());
            }
Ejemplo n.º 4
0
            public void Compose_ValidSingle_EqualsInput(
                [ValueSource("PastDatesWithNull")] DateTime?fromDate,
                [ValueSource("FutureDatesWithNull")] DateTime?toDate)
            {
                var virkning = VirkningType.Create(fromDate, toDate);
                var result   = VirkningType.Compose(virkning);

                Assert.NotNull(result);
            }
Ejemplo n.º 5
0
        public EgenskabType ToEgenskabType()
        {
            var ret = new EgenskabType()
            {
                BirthDate = this.PersonTotal.ToBirthdate().Value,

                // Birth registration authority
                //TODO: Is this assignment correct?
                FoedselsregistreringMyndighedNavn = PersonTotal.BirthPlaceOfRegistration,

                // Place of birth
                // Shall this be null? Is it birthplace or name at birth - I think it should be null
                FoedestedNavn = PersonTotal.BirthplaceText,

                PersonGenderCode = Utilities.PersonGenderCodeTypeFromChar(PersonTotal.Sex),

                NavnStruktur = PersonName != null?PersonName.ToNavnStrukturType() : null,

                                   AndreAdresser = Address != null?Address.ToForeignAddressFromSupplementary() : null,
                                                       //No contact channels implemented
                                                       KontaktKanal = null,
                                                       //Next of kin (nearest relative). Not implemented
                                                       NaermestePaaroerende = null,
                                                       //TODO: Fill this object
                                                       Virkning = VirkningType.Create(Utilities.GetMaxDate(PersonTotal.DateOfBirth, PersonTotal.StatusDate), null)
            };

            if (PersonName != null)
            {
                ret.Virkning = VirkningType.Compose(
                    ret.Virkning,
                    VirkningType.Create(Utilities.DateFromDecimal(PersonName.NameStartDate), null),
                    VirkningType.Create(Utilities.DateFromDecimal(PersonName.AddressingNameDate), null)
                    );
            }
            // TODO: More effect date fields here
            ret.Virkning.FraTidspunkt = TidspunktType.Create(Utilities.GetMaxDate(PersonTotal.DateOfBirth));
            return(ret);
        }
Ejemplo n.º 6
0
            public void Compose_Valid_DoubleOpen()
            {
                var result = VirkningType.Compose(VirkningType.Create(null, null), VirkningType.Create(null, null));

                Assert.True(VirkningType.IsDoubleOpen(result));
            }
Ejemplo n.º 7
0
 public void Compose_NullElement_ThrowsException()
 {
     var result = VirkningType.Compose(new VirkningType[] { null });
 }
Ejemplo n.º 8
0
 public void Compose_Null_ThrowsException()
 {
     var result = VirkningType.Compose(null as VirkningType[]);
 }