Exemplo n.º 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()));
        }
Exemplo n.º 2
0
        public void ThenNoStatusChangeButOfficiallyAssigned(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasRetired addressWasRetired,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab.WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasRetired)
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressWasOfficiallyAssigned(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
Exemplo n.º 3
0
        public void WhenStatusIsInUse(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab
                                             .WithStatus(CrabAddressStatus.InUse);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered)
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressBecameCurrent(addressId),
                         new AddressWasOfficiallyAssigned(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
Exemplo n.º 4
0
        public void GivenWasCorrectedToOfficiallyAssignedWhenStatusIsProposed(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasCorrectedToOfficiallyAssigned addressWasCorrectedToOfficiallyAssigned,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab
                                             .WithStatus(CrabAddressStatus.Proposed);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .Given(addressId, addressWasCorrectedToOfficiallyAssigned)
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressWasProposed(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
Exemplo n.º 5
0
        public void GivenWasCorrectedToNotOffiallyAssignedWhenStatusIsUnoffical(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasCorrectedToNotOfficiallyAssigned addressWasCorrectedToNotOfficiallyAssigned,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab
                                             .WithStatus(CrabAddressStatus.Unofficial);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .Given(addressId, addressWasCorrectedToNotOfficiallyAssigned)
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressBecameCurrent(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
        public void ThenAddressWasCorrectedToCurrentIfStatusIsOutOfUseAndCorrection(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab
                                             .WithStatus(CrabAddressStatus.OutOfUse)
                                             .WithCrabModification(CrabModification.Correction);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered)
                   .When(importSubaddressStatusFromCrab)
                   .Then(addressId,
                         new AddressWasCorrectedToCurrent(addressId),
                         new AddressWasCorrectedToOfficiallyAssigned(addressId),
                         importSubaddressStatusFromCrab.ToLegacyEvent()));
        }
        public void ThenAddressBecameComplete(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasPositioned addressWasPositioned,
            ImportSubaddressStatusFromCrab importSubaddressStatusFromCrab)
        {
            importSubaddressStatusFromCrab = importSubaddressStatusFromCrab.WithStatus(CrabAddressStatus.Proposed);

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