コード例 #1
0
        public void WithStatusProposedWhenOlderLifetime(AddressId addressId,
                                                        AddressWasRegistered addressWasRegistered,
                                                        AddressWasProposed addressWasProposed,
                                                        AddressHouseNumberStatusWasImportedFromCrab addressHouseNumberStatusWasImportedFromCrab,
                                                        AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
                                                        ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            addressHouseNumberStatusWasImportedFromCrab = addressHouseNumberStatusWasImportedFromCrab
                                                          .WithStatus(CrabAddressStatus.Proposed);

            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithLifetime(new CrabLifetime(addressHouseNumberStatusWasImportedFromCrab.BeginDateTime.Value.PlusDays(-1), null))
                                              .WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressHouseNumberStatusWasImportedFromCrab
                          )
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
コード例 #2
0
        public void WithRemovedStatusWhenStatusInUseAndSameLifetimeOfPreviouslyRemovedStatus(AddressId addressId,
                                                                                             AddressWasRegistered addressWasRegistered,
                                                                                             AddressWasProposed addressWasProposed,
                                                                                             AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
                                                                                             AddressHouseNumberStatusWasImportedFromCrab addressHouseNumberStatusWasImportedFromCrab,
                                                                                             AddressStatusWasRemoved addressStatusWasRemoved,
                                                                                             AddressHouseNumberStatusWasImportedFromCrab addressHouseNumberStatusWasImportedFromCrabDelete,
                                                                                             ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab,
                                                                                             CrabLifetime lifetime)
        {
            var statusId = new CrabHouseNumberStatusId(1);

            addressHouseNumberStatusWasImportedFromCrab = addressHouseNumberStatusWasImportedFromCrab
                                                          .WithHouseNumberStatusId(statusId)
                                                          .WithStatus(CrabAddressStatus.Proposed)
                                                          .WithBeginDate(lifetime.BeginDateTime);
            addressHouseNumberStatusWasImportedFromCrabDelete = addressHouseNumberStatusWasImportedFromCrabDelete
                                                                .WithHouseNumberStatusId(statusId)
                                                                .WithStatus(CrabAddressStatus.Proposed)
                                                                .WithCrabModification(CrabModification.Delete)
                                                                .WithBeginDate(lifetime.BeginDateTime);

            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithLifetime(lifetime)
                                              .WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressHouseNumberStatusWasImportedFromCrab,
                          addressStatusWasRemoved,
                          addressHouseNumberStatusWasImportedFromCrabDelete
                          )
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressBecameCurrent(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }