Пример #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 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()));
        }
Пример #3
0
        public void ImportSubaddressPositionFromCrab(
            CrabAddressPositionId addressPositionId,
            CrabSubaddressId subaddressId,
            WkbGeometry addressPosition,
            CrabAddressPositionOrigin addressPositionOrigin,
            CrabAddressNature addressNature,
            CrabLifetime lifetime,
            CrabTimestamp timestamp,
            CrabOperator @operator,
            CrabModification?modification,
            CrabOrganisation?organisation)
        {
            if (IsRemoved && modification != CrabModification.Delete)
            {
                return;
            }

            var legacyEvent = new AddressSubaddressPositionWasImportedFromCrab(
                addressPositionId,
                subaddressId,
                addressPosition,
                addressPositionOrigin,
                addressNature,
                lifetime,
                timestamp,
                @operator,
                modification,
                organisation);

            ApplyPositionChangeFor <AddressSubaddressPositionWasImportedFromCrab, int>(_crabSubaddressPositionEvents, legacyEvent);

            ApplyAddressCompletion();

            ApplyChange(legacyEvent);
        }
Пример #4
0
 public static AddressSubaddressPositionWasImportedFromCrab WithModification(this AddressSubaddressPositionWasImportedFromCrab @event, CrabModification modification)
 {
     return(new AddressSubaddressPositionWasImportedFromCrab(
                new CrabAddressPositionId(@event.AddressPositionId),
                new CrabSubaddressId(@event.SubaddressId),
                new WkbGeometry(@event.AddressPosition),
                @event.AddressPositionOrigin,
                new CrabAddressNature(@event.AddressNature),
                new CrabLifetime(@event.BeginDateTime, @event.EndDateTime),
                new CrabTimestamp(@event.Timestamp),
                new CrabOperator(@event.Operator),
                modification,
                @event.Organisation));
 }
Пример #5
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()));
        }
Пример #6
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()));
        }
Пример #7
0
 private void When(AddressSubaddressPositionWasImportedFromCrab @event)
 {
     _crabSubaddressPositionEvents.Add(@event);
     WhenCrabEventApplied();
 }