Exemplo n.º 1
0
        public void ThenAddressBecameIncompleteWhenModificationIsDelete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            AddressWasPositioned addressWasPositioned,
            AddressBecameComplete addressBecameComplete,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab.WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressWasPositioned,
                          addressBecameComplete)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressStatusWasRemoved(addressId),
                         new AddressOfficialAssignmentWasRemoved(addressId),
                         new AddressBecameIncomplete(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
Exemplo n.º 2
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()));
        }
Exemplo n.º 3
0
        public void WithStatusProposedWhenModificationIsDelete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab
                                              .WithCrabModification(CrabModification.Delete)
                                              .WithStatus(CrabAddressStatus.Proposed);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         importHouseNumberStatusFromCrab.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()));
        }
Exemplo n.º 5
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()));
        }
Exemplo n.º 6
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()));
        }
Exemplo n.º 8
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()));
        }
Exemplo n.º 9
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()));
        }