예제 #1
0
        public void WhenModificationIsCorrection(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned
                          )
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressPositionWasCorrected(addressId,
                                                         new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
예제 #2
0
        public void WhenPositionQualityIsLower(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImported,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, new ExtendedWkbGeometry(addressHouseNumberPositionWasImported.AddressPosition)));

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

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImported)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
예제 #3
0
        public void ThenNoPositionChangeWhenOlderLifetimeAndLessQuality(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedFromCrab,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

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

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImportedFromCrab)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
예제 #4
0
        public void WhenPositionQualityIsHigher(
            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.ManualIndicationFromEntryOfBuilding)
                                               .WithLifetime(crabLifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImported)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
예제 #5
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()));
        }
        public async Task AddressWasPositionedSetsPosition(
            AddressId addressId,
            WkbGeometry geometry,
            Provenance provenance,
            AddressWasRegistered addressWasRegistered)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.Interpolated, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(provenance);

            await Assert(
                Given(addressWasRegistered, addressWasPositioned)
                .Expect(
                    new AddressComparer <AddressDetailItem>(),
                    ctx => ctx.AddressDetail,
                    new AddressDetailItem
            {
                AddressId             = addressWasRegistered.AddressId,
                StreetNameId          = addressWasRegistered.StreetNameId,
                HouseNumber           = addressWasRegistered.HouseNumber,
                Position              = addressWasPositioned.ExtendedWkbGeometry.ToByteArray(),
                PositionMethod        = addressWasPositioned.GeometryMethod,
                PositionSpecification = addressWasPositioned.GeometrySpecification,
                VersionTimestamp      = addressWasPositioned.Provenance.Timestamp
            }));
        }
예제 #7
0
        public static AddressWasPositioned WithAddressGeometry(this AddressWasPositioned @event, AddressGeometry addressGeometry)
        {
            var addressWasPositioned = new AddressWasPositioned(new AddressId(@event.AddressId), addressGeometry);

            (addressWasPositioned as ISetProvenance).SetProvenance(@event.Provenance.ToProvenance());
            return(addressWasPositioned);
        }
예제 #8
0
        public void When2PositionsAreCurrentAndLowestGetsHistorized(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedHigh,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedLow,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.Parcel, new ExtendedWkbGeometry(addressHouseNumberPositionWasImportedHigh.AddressPosition)));

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

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

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

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImportedLow,
                          addressWasPositioned2,
                          addressHouseNumberPositionWasImportedHigh)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
예제 #9
0
        public void WithRemovedPositionWhenSameLifetimeOfPreviouslyRemovedPosition(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedFromCrab,
            AddressPositionWasRemoved addressPositionWasRemoved,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedFromCrabDelete,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab,
            CrabLifetime lifetime)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImportedFromCrab,
                          addressPositionWasRemoved,
                          addressHouseNumberPositionWasImportedFromCrabDelete
                          )
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.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()));
        }
예제 #11
0
        public void ThenNoPositionChangeWhenPositionIsTheSame(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

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

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

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
 public async Task AddressWasPositionedAfterRemoveIsSet(
     AddressWasRegistered addressWasRegistered,
     AddressWasRemoved addressWasRemoved,
     AddressWasPositioned addressWasPositioned,
     WkbGeometry geometry)
 {
     addressWasPositioned = addressWasPositioned.WithAddressGeometry(new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Building, GeometryHelpers.CreateEwkbFrom(geometry)));
     await Assert(
         Given(addressWasRegistered, addressWasRemoved, addressWasPositioned)
         .Expect(
             new AddressComparer <AddressDetailItem>(),
             ctx => ctx.AddressDetail, new AddressDetailItem
     {
         AddressId             = addressWasRegistered.AddressId,
         StreetNameId          = addressWasRegistered.StreetNameId,
         HouseNumber           = addressWasRegistered.HouseNumber,
         Position              = addressWasPositioned.ExtendedWkbGeometry.ToByteArray(),
         PositionMethod        = addressWasPositioned.GeometryMethod,
         PositionSpecification = addressWasPositioned.GeometrySpecification,
         Removed          = true,
         VersionTimestamp = addressWasPositioned.Provenance.Timestamp
     }));
 }
예제 #13
0
 private void When(AddressWasPositioned @event)
 {
     _geometry = new AddressGeometry(@event.GeometryMethod, @event.GeometrySpecification, new ExtendedWkbGeometry(@event.ExtendedWkbGeometry));
 }