public void ThenPositionChangeWhenOlderLifetimeAndHigherQuality(
            Fixture fixture,
            AddressId addressId,
            WkbGeometry wkbGeometry,
            CrabLifetime lifetime,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressGeometry = new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry));

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

            Assert(RegisteredAddressScenario(fixture)
                   .Given <AddressWasPositioned>(addressId, e => e.WithAddressGeometry(addressGeometry))
                   .Given <AddressHouseNumberPositionWasImportedFromCrab>(addressId, e => e
                                                                          .WithWkbGeometry(wkbGeometry)
                                                                          .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                                          .WithBeginDate(lifetime.BeginDateTime.Value.PlusDays(1)))
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario6(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3,
                                                                WkbGeometry geometry4)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(5790888),
                crabHouseNumberId,
                geometry4,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2015, 7, 30, 10, 57, 33, 273, TimeSpan.Zero))),
                new CrabOperator("13040:7405:DAERO"),
                CrabModification.Insert,
                Enum.Parse <CrabOrganisation>("5"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario5(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         command.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario7(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3,
                                                                WkbGeometry geometry4)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(4087928),
                crabHouseNumberId,
                geometry3,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2015, 7, 30, 10, 57, 33, 920, TimeSpan.Zero))),
                new CrabOperator("13040:7405:DAERO"),
                CrabModification.Delete,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario6(fixture, crabHouseNumberId, geometry1, geometry2, geometry3, geometry4))
                   .When(command)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry4))),
                         command.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario3(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(4087928),
                crabHouseNumberId,
                geometry2,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2014, 2, 2, 22, 21, 24, 997, TimeSpan.Zero))),
                new CrabOperator("VLM\\CRABSSISservice"),
                CrabModification.Insert,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario2(fixture, crabHouseNumberId, geometry1))
                   .When(command)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Parcel, GeometryHelpers.CreateEwkbFrom(geometry2))),
                         command.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario5(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(4087928),
                crabHouseNumberId,
                geometry3,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2014, 3, 19, 16, 56, 36, 90, TimeSpan.Zero))),
                new CrabOperator("VLM\\CRABSSISservice"),
                CrabModification.Correction,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario4(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         command.ToLegacyEvent()));
        }
        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()));
        }
        private IEventCentricTestSpecificationBuilder Scenario2(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(1),
                crabHouseNumberId,
                geometry,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2014, 2, 2, 20, 43, 51, 373, TimeSpan.Zero))),
                new CrabOperator("VLM\\CRABSSISservice"),
                CrabModification.Delete,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario1(fixture, crabHouseNumberId, geometry))
                   .When(command)
                   .Then(addressId,
                         new AddressPositionWasRemoved(addressId),
                         command.ToLegacyEvent()));
        }
Exemple #8
0
        private IEventCentricTestSpecificationBuilder Scenario8(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(3516111),
                crabHouseNumberId,
                geometry3,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("13"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), LocalDateTime.FromDateTime(new DateTime(2014, 12, 31))),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2013, 6, 4, 13, 1, 9, 137, TimeSpan.Zero))),
                new CrabOperator("13029:kenisils"),
                CrabModification.Historize,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario7(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         new AddressPositionWasRemoved(addressId),
                         command.ToLegacyEvent()));
        }
Exemple #9
0
        private IEventCentricTestSpecificationBuilder Scenario10(Fixture fixture,
                                                                 CrabHouseNumberId crabHouseNumberId,
                                                                 WkbGeometry geometry1,
                                                                 WkbGeometry geometry2,
                                                                 WkbGeometry geometry3)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(3408534),
                crabHouseNumberId,
                geometry2,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), LocalDateTime.FromDateTime(new DateTime(2014, 10, 3))),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2014, 10, 17, 20, 26, 30, 480, TimeSpan.Zero))),
                new CrabOperator("13029:kenisils"),
                CrabModification.Correction,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario9(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         command.ToLegacyEvent()));
        }
Exemple #10
0
        private IEventCentricTestSpecificationBuilder Scenario8(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3,
                                                                WkbGeometry geometry4,
                                                                WkbGeometry geometry5)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(5790888),
                crabHouseNumberId,
                geometry5,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2016, 2, 1, 10, 24, 37, 907, TimeSpan.Zero))),
                new CrabOperator("VLM\\daemsgl"),
                CrabModification.Correction,
                Enum.Parse <CrabOrganisation>("5"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario7(fixture, crabHouseNumberId, geometry1, geometry2, geometry3, geometry4))
                   .When(command)
                   .Then(addressId,
                         new AddressPositionWasCorrected(addressId, new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry5))),
                         command.ToLegacyEvent()));
        }
        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()));
        }
        public void ThenAddressBecameIncompleteWhenModificationIsDelete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            AddressWasPositioned addressWasPositioned,
            AddressBecameComplete addressBecameComplete,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            //addressWasPositioned
            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab.WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressWasPositioned,
                          addressBecameComplete)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressPositionWasRemoved(addressId),
                         new AddressBecameIncomplete(addressId),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        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()));
        }
        private IEventCentricTestSpecificationBuilder Scenario1(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var addressWasRegistered = new AddressWasRegistered(
                addressId,
                fixture.Create <StreetNameId>(),
                fixture.Create <HouseNumber>());

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

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(1),
                crabHouseNumberId,
                geometry,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2011, 4, 29, 14, 50, 10, 483, TimeSpan.Zero))),
                new CrabOperator("VLM\\thijsge"),
                CrabModification.Insert,
                Enum.Parse <CrabOrganisation>("5"));

            return(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .When(command)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry))),
                         command.ToLegacyEvent()));
        }
 public void ThenAddressRemovedException(AddressId addressId,
                                         AddressWasRegistered addressWasRegistered,
                                         AddressWasRemoved addressWasRemoved,
                                         ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
 {
     Assert(new Scenario()
            .Given(addressId, addressWasRegistered, addressWasRemoved)
            .When(importHouseNumberPositionFromCrab)
            .Throws(new AddressRemovedException($"Cannot change removed address for address id {addressId}")));
 }
Exemple #16
0
        public void WhenLifetimeHasNoEndDate(
            IFixture fixture,
            AddressId addressId,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab.WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromEntryOfBuilding);

            Assert(RetiredAddressScenario(fixture)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        public void WhenModificationIsDelete(
            Fixture fixture,
            AddressId addressId,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabModification(CrabModification.Delete);

            Assert(RegisteredAddressScenario(fixture)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        public void ThenNoExceptionWhenModificationIsDelete(AddressId addressId,
                                                            AddressWasRegistered addressWasRegistered,
                                                            AddressWasRemoved addressWasRemoved,
                                                            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered, addressWasRemoved)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
Exemple #19
0
 private static void ImportHouseNumberPositionFromCrab(Address address, ImportHouseNumberPositionFromCrab message)
 {
     address.ImportHouseNumberPositionFromCrab(
         message.AddressPositionId,
         message.HouseNumberId,
         message.AddressPosition,
         message.AddressPositionOrigin,
         message.AddressNature,
         message.Lifetime,
         message.Timestamp,
         message.Operator,
         message.Modification,
         message.Organisation);
 }
Exemple #20
0
 public static ImportHouseNumberPositionFromCrab WithWkbGeometry(this ImportHouseNumberPositionFromCrab command, WkbGeometry wkbGeometry)
 {
     return(new ImportHouseNumberPositionFromCrab(
                command.AddressPositionId,
                command.HouseNumberId,
                wkbGeometry,
                command.AddressNature,
                command.AddressPositionOrigin,
                command.Lifetime,
                command.Timestamp,
                command.Operator,
                command.Modification,
                command.Organisation));
 }
Exemple #21
0
 public static AddressHouseNumberPositionWasImportedFromCrab ToLegacyEvent(this ImportHouseNumberPositionFromCrab command)
 {
     return(new AddressHouseNumberPositionWasImportedFromCrab(
                command.AddressPositionId,
                command.HouseNumberId,
                command.AddressPosition,
                command.AddressPositionOrigin,
                command.AddressNature,
                command.Lifetime,
                command.Timestamp,
                command.Operator,
                command.Modification,
                command.Organisation));
 }
Exemple #22
0
 public static ImportHouseNumberPositionFromCrab WithPositionId(this ImportHouseNumberPositionFromCrab command, CrabAddressPositionId addressPositionId)
 {
     return(new ImportHouseNumberPositionFromCrab(
                addressPositionId,
                command.HouseNumberId,
                command.AddressPosition,
                command.AddressNature,
                command.AddressPositionOrigin,
                command.Lifetime,
                command.Timestamp,
                command.Operator,
                command.Modification,
                command.Organisation));
 }
        public void WhenCrabAddressPositionOrigin(
            CrabAddressPositionOrigin crabAddressPositionOrigin,
            GeometryMethod geometryMethod,
            GeometrySpecification geometrySpecification,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabAddressPositionOrigin(crabAddressPositionOrigin);

            Assert(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(geometryMethod, geometrySpecification, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        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()));
        }
        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(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            importHouseNumberPositionFromCrab.WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         new AddressBecameComplete(addressId),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        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()));
        }