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 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())); }
public void ImportHouseNumberPositionFromCrab( CrabAddressPositionId addressPositionId, CrabHouseNumberId houseNumberId, WkbGeometry addressPosition, CrabAddressPositionOrigin addressPositionOrigin, CrabAddressNature addressNature, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { GuardRemoved(modification); var legacyEvent = new AddressHouseNumberPositionWasImportedFromCrab( addressPositionId, houseNumberId, addressPosition, addressPositionOrigin, addressNature, lifetime, timestamp, @operator, modification, organisation); ApplyPositionChangeFor <AddressHouseNumberPositionWasImportedFromCrab, int>(_crabHouseNumberPositionEvents, legacyEvent); ApplyAddressCompletion(); ApplyChange(legacyEvent); }
public static AddressHouseNumberPositionWasImportedFromCrab WithWkbGeometry(this AddressHouseNumberPositionWasImportedFromCrab @event, WkbGeometry wkbGeometry) { return(new AddressHouseNumberPositionWasImportedFromCrab( new CrabAddressPositionId(@event.AddressPositionId), new CrabHouseNumberId(@event.HouseNumberId), wkbGeometry, @event.AddressPositionOrigin, new CrabAddressNature(@event.AddressNature), new CrabLifetime(@event.BeginDateTime, @event.EndDateTime), new CrabTimestamp(@event.Timestamp), new CrabOperator(@event.Operator), @event.Modification, @event.Organisation)); }
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 GivenAddressPositionHasEndDate( IFixture fixture, AddressId addressId, AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImported, ImportHouseNumberFromCrab importHouseNumberFromCrab) { addressHouseNumberPositionWasImported = addressHouseNumberPositionWasImported .WithEndDate(DateTimeOffset.Now) .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromEntryOfBuilding); importHouseNumberFromCrab = importHouseNumberFromCrab .WithLifetime(new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), LocalDateTime.FromDateTime(DateTime.Now.AddDays(1)))); Assert(RegisteredAddressScenario(fixture) .Given(addressId, addressHouseNumberPositionWasImported) .When(importHouseNumberFromCrab) .Then(addressId, new AddressWasRetired(addressId), new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(new WkbGeometry(addressHouseNumberPositionWasImported.AddressPosition)))), importHouseNumberFromCrab.ToLegacyEvent())); }
private void When(AddressHouseNumberPositionWasImportedFromCrab @event) { _crabHouseNumberPositionEvents.Add(@event); WhenCrabEventApplied(); }
public static AddressHouseNumberPositionWasImportedFromCrab WithEndDate(this AddressHouseNumberPositionWasImportedFromCrab @event, DateTimeOffset?endDate) { return(@event.WithEndDate(endDate.HasValue ? LocalDateTime.FromDateTime(endDate.Value.LocalDateTime) : new LocalDateTime?())); }