Пример #1
0
        public void WithStatusDeleteWhenNewerStatusIsPresent(AddressId addressId,
                                                             AddressWasRegistered addressWasRegistered,
                                                             AddressWasProposed addressWasProposed,
                                                             AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
                                                             AddressSubaddressStatusWasImportedFromCrab addressSubaddressStatusWasImportedFromCrabForProposed,
                                                             AddressBecameCurrent addressBecameCurrent,
                                                             AddressSubaddressStatusWasImportedFromCrab addressSubaddressStatusWasImportedFromCrabForCurrent,
                                                             ImportSubaddressStatusFromCrab importSubaddressStatusFromCrabDeleteProposed)
        {
            var lifetime       = new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), null);
            var deleteProposed = importSubaddressStatusFromCrabDeleteProposed
                                 .WithStatus(CrabAddressStatus.InUse)
                                 .WithLifetime(lifetime)
                                 .WithCrabModification(CrabModification.Delete)
                                 .WithStatusId(new CrabSubaddressStatusId(addressSubaddressStatusWasImportedFromCrabForProposed.SubaddressStatusId));

            addressSubaddressStatusWasImportedFromCrabForProposed = addressSubaddressStatusWasImportedFromCrabForProposed
                                                                    .WithBeginDate(lifetime.BeginDateTime)
                                                                    .WithStatus(CrabAddressStatus.Proposed);
            addressSubaddressStatusWasImportedFromCrabForCurrent = addressSubaddressStatusWasImportedFromCrabForCurrent
                                                                   .WithBeginDate(lifetime.BeginDateTime)
                                                                   .WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressSubaddressStatusWasImportedFromCrabForProposed,
                          addressBecameCurrent,
                          addressSubaddressStatusWasImportedFromCrabForCurrent)
                   .When(deleteProposed)
                   .Then(addressId,
                         deleteProposed.ToLegacyEvent()));
        }
 public async Task AddressBecameCurrentSetsStatusToCurrent(
     AddressWasRegistered addressWasRegistered,
     AddressBecameCurrent addressBecameCurrent)
 {
     await Assert(
         Given(addressWasRegistered,
               addressBecameCurrent)
         .Expect(ctx => ctx.AddressDetail, new AddressDetailItem
     {
         AddressId        = addressWasRegistered.AddressId,
         StreetNameId     = addressWasRegistered.StreetNameId,
         HouseNumber      = addressWasRegistered.HouseNumber,
         Status           = AddressStatus.Current,
         VersionTimestamp = addressBecameCurrent.Provenance.Timestamp
     }));
 }
 public async Task AddressStatusWasCorrectedToRemovedSetsStatusToNull(
     AddressWasRegistered addressWasRegistered,
     AddressBecameCurrent addressBecameCurrent,
     AddressStatusWasCorrectedToRemoved addressStatusWasCorrectedToRemoved)
 {
     await Assert(
         Given(addressWasRegistered,
               addressBecameCurrent,
               addressStatusWasCorrectedToRemoved)
         .Expect(ctx => ctx.AddressDetail, new AddressDetailItem
     {
         AddressId        = addressWasRegistered.AddressId,
         StreetNameId     = addressWasRegistered.StreetNameId,
         HouseNumber      = addressWasRegistered.HouseNumber,
         Status           = null,
         VersionTimestamp = addressStatusWasCorrectedToRemoved.Provenance.Timestamp
     }));
 }
Пример #4
0
        public void WithStatusCurrentWhenModificationIsDelete(AddressId addressId,
                                                              AddressWasRegistered addressWasRegistered,
                                                              AddressBecameCurrent addressBecameCurrent,
                                                              AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
                                                              ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab
                                             .WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressBecameCurrent,
                          addressWasOfficiallyAssigned
                          )
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressStatusWasRemoved(addressId),
                         new AddressOfficialAssignmentWasRemoved(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
Пример #5
0
 private void When(AddressBecameCurrent @event)
 {
     SetStatus(AddressStatus.Current);
 }