Пример #1
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()));
        }