示例#1
0
        public void WithRemovedPostalCodeWhenSameLifetimeOfPreviouslyRemovedPostalCode(
            Fixture fixture,
            AddressId addressId,
            CrabHouseNumberMailCantonId crabHouseNumberMailCantonId,
            ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab,
            CrabLifetime lifetime
            )
        {
            importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab
                                                  .WithLifetime(lifetime);

            Assert(RegisteredAddressScenario(fixture)
                   .Given <AddressPostalCodeWasChanged>(addressId)
                   .Given <AddressHouseNumberMailCantonWasImportedFromCrab>(addressId,
                                                                            e => e.WithBeginDate(lifetime.BeginDateTime)
                                                                            .WithHouseNumberMailCantonId(crabHouseNumberMailCantonId))
                   .Given <AddressPositionWasRemoved>(addressId)
                   .Given <AddressHouseNumberMailCantonWasImportedFromCrab>(addressId,
                                                                            e => e.WithBeginDate(lifetime.BeginDateTime)
                                                                            .WithHouseNumberMailCantonId(crabHouseNumberMailCantonId)
                                                                            .WithCrabModification(CrabModification.Delete))
                   .When(importHouseNumberMailCantonFromCrab)
                   .Then(addressId,
                         new AddressPostalCodeWasChanged(addressId, new PostalCode(importHouseNumberMailCantonFromCrab.MailCantonCode)),
                         importHouseNumberMailCantonFromCrab.ToLegacyEvent()));
        }
示例#2
0
        public void ImportHouseNumberMailCantonFromCrab(
            CrabHouseNumberMailCantonId houseNumberMailCantonId,
            CrabHouseNumberId houseNumberId,
            CrabMailCantonId mailCantonId,
            CrabMailCantonCode mailCantonCode,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            if (!IsSubaddress)
            {
                GuardRemoved(modification);
            }

            var legacyEvent = new AddressHouseNumberMailCantonWasImportedFromCrab(
                houseNumberMailCantonId,
                houseNumberId,
                mailCantonId,
                mailCantonCode,
                lifetime,
                timestamp,
                @operator,
                modification,
                organisation);

            if (!(IsSubaddress && IsRemoved) && !(_coupledHouseNumberId != null && _coupledHouseNumberId != houseNumberId))
            {
                ApplyPostalCodeChangeFor(legacyEvent);
            }

            ApplyChange(legacyEvent);
        }
 public ImportHouseNumberMailCantonFromCrab(
     CrabHouseNumberMailCantonId houseNumberMailCantonId,
     CrabHouseNumberId houseNumberId,
     CrabMailCantonId mailCantonId,
     CrabMailCantonCode mailCantonCode,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberMailCantonId = houseNumberMailCantonId;
     HouseNumberId           = houseNumberId;
     MailCantonId            = mailCantonId;
     Lifetime       = lifetime;
     Timestamp      = timestamp;
     Operator       = @operator;
     Modification   = modification;
     Organisation   = organisation;
     MailCantonCode = mailCantonCode;
 }
示例#4
0
 public AddressHouseNumberMailCantonWasImportedFromCrab(
     CrabHouseNumberMailCantonId houseNumberMailCantonId,
     CrabHouseNumberId houseNumberId,
     CrabMailCantonId mailCantonId,
     CrabMailCantonCode mailCantonCode,
     CrabLifetime lifetime,
     CrabTimestamp timestamp,
     CrabOperator @operator,
     CrabModification?modification,
     CrabOrganisation?organisation)
 {
     HouseNumberMailCantonId = houseNumberMailCantonId;
     HouseNumberId           = houseNumberId;
     MailCantonId            = mailCantonId;
     MailCantonCode          = mailCantonCode;
     BeginDateTime           = lifetime.BeginDateTime;
     EndDateTime             = lifetime.EndDateTime;
     Timestamp    = timestamp;
     Operator     = @operator;
     Modification = modification;
     Organisation = organisation;
 }
示例#5
0
 public static AddressHouseNumberMailCantonWasImportedFromCrab WithHouseNumberMailCantonId(this AddressHouseNumberMailCantonWasImportedFromCrab @event, CrabHouseNumberMailCantonId houseNumberMailCantonId)
 {
     return(new AddressHouseNumberMailCantonWasImportedFromCrab(
                houseNumberMailCantonId,
                new CrabHouseNumberId(@event.HouseNumberId),
                new CrabMailCantonId(@event.MailCantonId),
                new CrabMailCantonCode(@event.MailCantonCode),
                new CrabLifetime(@event.BeginDateTime, @event.EndDateTime),
                new CrabTimestamp(@event.Timestamp),
                new CrabOperator(@event.Operator),
                @event.Modification,
                @event.Organisation));
 }