Пример #1
0
        public void WhenPositionQualityIsLower(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImported,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, new ExtendedWkbGeometry(addressSubaddressPositionWasImported.AddressPosition)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            addressSubaddressPositionWasImported = addressSubaddressPositionWasImported
                                                   .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                   .WithBeginDate(crabLifetime.BeginDateTime);

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                               .WithLifetime(crabLifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImported)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #2
0
        public void ThenPositionChangeWhenOlderLifetimeAndHigherQuality(
            Fixture fixture,
            AddressId addressId,
            WkbGeometry wkbGeometry,
            CrabLifetime lifetime,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressGeometry = new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry));

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromStand)
                                               .WithLifetime(lifetime);

            Assert(RegisteredAddressScenario(fixture)
                   .Given <AddressWasPositioned>(addressId, e => e.WithAddressGeometry(addressGeometry))
                   .Given <AddressSubaddressPositionWasImportedFromCrab>(addressId, e => e
                                                                         .WithWkbGeometry(wkbGeometry)
                                                                         .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                                         .WithBeginDate(lifetime.BeginDateTime.Value.PlusDays(1)))
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #3
0
        public void WhenModificationIsCorrection(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabModification(CrabModification.Correction)
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromBuilding);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned
                          )
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressPositionWasCorrected(addressId,
                                                         new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #4
0
        public void ThenNoPositionChangeWhenOlderLifetimeAndLessQuality(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedFromCrab,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            addressSubaddressPositionWasImportedFromCrab = addressSubaddressPositionWasImportedFromCrab
                                                           .WithWkbGeometry(wkbGeometry)
                                                           .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromStand);

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                               .WithLifetime(new CrabLifetime(addressSubaddressPositionWasImportedFromCrab.BeginDateTime.Value.PlusDays(-1),
                                                                              addressSubaddressPositionWasImportedFromCrab.EndDateTime));

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImportedFromCrab)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
        public void ThenAddressBecameIncompleteWhenModificationIsDelete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            AddressWasPositioned addressWasPositioned,
            AddressBecameComplete addressBecameComplete,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            //addressWasPositioned
            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab.WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressWasPositioned,
                          addressBecameComplete)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressPositionWasRemoved(addressId),
                         new AddressBecameIncomplete(addressId),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #6
0
        public void WhenModificationIsDelete(
            Fixture fixture,
            AddressId addressId,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabModification(CrabModification.Delete);

            Assert(RegisteredAddressScenario(fixture)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
        public void WhenLifetimeHasNoEndDate(
            IFixture fixture,
            AddressId addressId,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab.WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromEntryOfBuilding);

            Assert(RetiredAddressScenario(fixture)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
        public void ThenNoExceptionWhenModificationIsDelete(AddressId addressId,
                                                            AddressWasRegistered addressWasRegistered,
                                                            AddressWasRemoved addressWasRemoved,
                                                            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered, addressWasRemoved)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #9
0
        public void WhenCrabAddressPositionOrigin(
            CrabAddressPositionOrigin crabAddressPositionOrigin,
            GeometryMethod geometryMethod,
            GeometrySpecification geometrySpecification,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(crabAddressPositionOrigin);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(geometryMethod, geometrySpecification, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #10
0
        public void When2PositionsAreCurrentAndLowestGetsHistorized(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedHigh,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedLow,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.Parcel, new ExtendedWkbGeometry(addressSubaddressPositionWasImportedHigh.AddressPosition)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());
            var addressWasPositioned2 = new AddressWasPositioned(addressId,
                                                                 new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot,
                                                                                     new ExtendedWkbGeometry(addressSubaddressPositionWasImportedHigh.AddressPosition)));

            ((ISetProvenance)addressWasPositioned2).SetProvenance(fixture.Create <Provenance>());

            addressSubaddressPositionWasImportedLow = addressSubaddressPositionWasImportedLow
                                                      .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                                      .WithBeginDate(crabLifetime.BeginDateTime);

            addressSubaddressPositionWasImportedHigh = addressSubaddressPositionWasImportedHigh
                                                       .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                       .WithBeginDate(crabLifetime.BeginDateTime);

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithPositionId(new CrabAddressPositionId(addressSubaddressPositionWasImportedLow.AddressPositionId))
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                               .WithLifetime(new CrabLifetime(crabLifetime.BeginDateTime, LocalDateTime.FromDateTime(DateTime.Now)));

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImportedLow,
                          addressWasPositioned2,
                          addressSubaddressPositionWasImportedHigh)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #11
0
        public void WithRemovedPositionWhenSameLifetimeOfPreviouslyRemovedPosition(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedFromCrab,
            AddressPositionWasRemoved addressPositionWasRemoved,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedFromCrabDelete,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab,
            CrabLifetime lifetime)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());
            addressSubaddressPositionWasImportedFromCrab = addressSubaddressPositionWasImportedFromCrab
                                                           .WithWkbGeometry(wkbGeometry)
                                                           .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                           .WithBeginDate(lifetime.BeginDateTime);
            addressSubaddressPositionWasImportedFromCrabDelete = addressSubaddressPositionWasImportedFromCrabDelete
                                                                 .WithWkbGeometry(wkbGeometry)
                                                                 .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                                 .WithBeginDate(lifetime.BeginDateTime)
                                                                 .WithModification(CrabModification.Delete);

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromStand)
                                               .WithLifetime(lifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImportedFromCrab,
                          addressPositionWasRemoved,
                          addressSubaddressPositionWasImportedFromCrabDelete
                          )
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
        public void ThenAddressBecameComplete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            importSubaddressPositionFromCrab.WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         new AddressBecameComplete(addressId),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Пример #13
0
        public void ThenNoPositionChangeWhenPositionIsTheSame(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                               .WithWkbGeometry(wkbGeometry);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }