Example #1
0
        public void WithStatusDeleteWhenNewerStatusIsPresent(AddressId addressId,
                                                             AddressWasRegistered addressWasRegistered,
                                                             AddressWasProposed addressWasProposed,
                                                             AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
                                                             AddressHouseNumberStatusWasImportedFromCrab addressHouseNumberStatusWasImportedFromCrabForProposed,
                                                             AddressBecameCurrent addressBecameCurrent,
                                                             AddressHouseNumberStatusWasImportedFromCrab addressHouseNumberStatusWasImportedFromCrabForCurrent,
                                                             ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrabDeleteProposed)
        {
            var lifetime       = new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), null);
            var deleteProposed = importHouseNumberStatusFromCrabDeleteProposed
                                 .WithStatus(CrabAddressStatus.InUse)
                                 .WithLifetime(lifetime)
                                 .WithCrabModification(CrabModification.Delete)
                                 .WithStatusId(new CrabHouseNumberStatusId(addressHouseNumberStatusWasImportedFromCrabForProposed.HouseNumberStatusId));

            addressHouseNumberStatusWasImportedFromCrabForProposed = addressHouseNumberStatusWasImportedFromCrabForProposed
                                                                     .WithBeginDate(lifetime.BeginDateTime)
                                                                     .WithStatus(CrabAddressStatus.Proposed);
            addressHouseNumberStatusWasImportedFromCrabForCurrent = addressHouseNumberStatusWasImportedFromCrabForCurrent
                                                                    .WithBeginDate(lifetime.BeginDateTime)
                                                                    .WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressHouseNumberStatusWasImportedFromCrabForProposed,
                          addressBecameCurrent,
                          addressHouseNumberStatusWasImportedFromCrabForCurrent)
                   .When(deleteProposed)
                   .Then(addressId,
                         deleteProposed.ToLegacyEvent()));
        }
        public void ThenNoStatusChangeButOfficiallyAssigned(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasRetired addressWasRetired,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab.WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasRetired)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressWasOfficiallyAssigned(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
Example #3
0
        public void WhenStatusIsReserved(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithStatus(CrabAddressStatus.Reserved);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressWasProposed(addressId),
                         new AddressWasOfficiallyAssigned(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
Example #4
0
        public void GivenWasCorrectedToNotOffiallyAssignedWhenStatusIsUnoffical(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasCorrectedToNotOfficiallyAssigned addressWasCorrectedToNotOfficiallyAssigned,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithStatus(CrabAddressStatus.Unofficial);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .Given(addressId, addressWasCorrectedToNotOfficiallyAssigned)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressBecameCurrent(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
        public void ThenAddressWasCorrectedToCurrentIfStatusIsInUseAndCorrection(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithStatus(CrabAddressStatus.InUse)
                                              .WithCrabModification(CrabModification.Correction);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressWasCorrectedToCurrent(addressId),
                         new AddressWasCorrectedToOfficiallyAssigned(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
Example #6
0
        public void ThenAddressBecameComplete(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasPositioned addressWasPositioned,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab.WithStatus(CrabAddressStatus.Proposed);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressWasProposed(addressId),
                         new AddressWasOfficiallyAssigned(addressId),
                         new AddressBecameComplete(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }