public void ImportHouseNumberStatusFromCrab( CrabHouseNumberStatusId houseNumberStatusId, CrabHouseNumberId houseNumberId, CrabAddressStatus addressStatus, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { GuardRemoved(modification); var legacyEvent = new AddressHouseNumberStatusWasImportedFromCrab( houseNumberStatusId, houseNumberId, addressStatus, lifetime, timestamp, @operator, modification, organisation); ApplyStatusChangesFor(_houseNumberStatusChronicle, legacyEvent); ApplyAddressCompletion(); ApplyChange(legacyEvent); }
public void WithDifferentHouseNumberId() { var oldHouseNumberId = new CrabHouseNumberId(-1); var oldCommand = _fixture.Create <ImportTerrainObjectHouseNumberFromCrab>() .WithLifetime(new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), null)) .WithModification(CrabModification.Insert) .WithHouseNumberId(oldHouseNumberId); var command = _fixture.Create <ImportTerrainObjectHouseNumberFromCrab>() .WithLifetime(new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), null)) .WithModification(CrabModification.Correction) .WithTerrainObjectHouseNumberId(oldCommand.TerrainObjectHouseNumberId); Assert(new Scenario() .Given(_parcelId, _fixture.Create <ParcelWasRegistered>(), _fixture.Create <ParcelAddressWasAttached>() .WithAddressId(AddressId.CreateFor(oldHouseNumberId)), oldCommand.ToLegacyEvent()) .When(command) .Then(_parcelId, new ParcelAddressWasDetached(_parcelId, AddressId.CreateFor(oldHouseNumberId)), new ParcelAddressWasAttached(_parcelId, AddressId.CreateFor(command.HouseNumberId)), command.ToLegacyEvent())); }
public void ImportHouseNumberMailCantonFromCrab( CrabHouseNumberMailCantonId houseNumberMailCantonId, CrabHouseNumberId houseNumberId, CrabMailCantonId mailCantonId, CrabMailCantonCode mailCantonCode, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { if (!IsSubaddress) { GuardRemoved(modification); } var legacyEvent = new AddressHouseNumberMailCantonWasImportedFromCrab( houseNumberMailCantonId, houseNumberId, mailCantonId, mailCantonCode, lifetime, timestamp, @operator, modification, organisation); if (!(IsSubaddress && IsRemoved) && !(_coupledHouseNumberId != null && _coupledHouseNumberId != houseNumberId)) { ApplyPostalCodeChangeFor(legacyEvent); } ApplyChange(legacyEvent); }
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); }
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 TestScenario3(Fixture fixture, CrabHouseNumberId crabHouseNumberId, WkbGeometry geometry1, WkbGeometry geometry2) { Assert(Scenario3(fixture, crabHouseNumberId, geometry1, geometry2)); }
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())); }
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())); }
private IEventCentricTestSpecificationBuilder ExtraScenarioAddressGetRetired(Fixture fixture, CrabHouseNumberId crabHouseNumberId, WkbGeometry geometry1, WkbGeometry geometry2, WkbGeometry geometry3) { var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId()); var command = new ImportHouseNumberFromCrab( crabHouseNumberId, _streetNameId, _houseNumber, fixture.Create <GrbNotation>(), 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.Historize, Enum.Parse <CrabOrganisation>("1")); return(new AutoFixtureScenario(fixture) .Given(Scenario10(fixture, crabHouseNumberId, geometry1, geometry2, geometry3)) .When(command) .Then(addressId, new AddressWasRetired(addressId), new AddressPositionWasCorrected(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Parcel, GeometryHelpers.CreateEwkbFrom(geometry2))), command.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())); }
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())); }
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())); }
public void TestExtraScenarioAddressGetRetired(Fixture fixture, CrabHouseNumberId crabHouseNumberId, WkbGeometry geometry1, WkbGeometry geometry2, WkbGeometry geometry3) { Assert(ExtraScenarioAddressGetRetired(fixture, crabHouseNumberId, geometry1, geometry2, geometry3)); }
public void TestScenario7(Fixture fixture, CrabHouseNumberId crabHouseNumberId, WkbGeometry geometry1, WkbGeometry geometry2, WkbGeometry geometry3, WkbGeometry geometry4) { Assert(Scenario7(fixture, crabHouseNumberId, geometry1, geometry2, geometry3, geometry4)); }
public AssignPersistentLocalIdForCrabHouseNumberId( CrabHouseNumberId houseNumberId, PersistentLocalId persistentLocalId, PersistentLocalIdAssignmentDate assignmentDate) { HouseNumberId = houseNumberId; PersistentLocalId = persistentLocalId; AssignmentDate = assignmentDate; }
public IEnumerable <AddressId> AddressIdsEligableToRemoveFor(CrabHouseNumberId houseNumberId) { if (LastSubaddressRecordsByHouseNumberId.ContainsKey(houseNumberId)) { return(LastSubaddressRecordsByHouseNumberId[houseNumberId] .Where(x => _addressIds.Contains(AddressId.CreateFor(new CrabSubaddressId(x.SubaddressId)))) .Select(x => AddressId.CreateFor(new CrabSubaddressId(x.SubaddressId)))); } return(new List <AddressId>()); }
private void When(AddressHouseNumberWasImportedFromCrab @event) { var houseNumberId = new CrabHouseNumberId(@event.HouseNumberId); if (!_lastHouseNumberEventsForSubaddress.Any()) { _coupledHouseNumberId = houseNumberId; } _lastHouseNumberEventsForSubaddress[houseNumberId] = @event; WhenCrabEventApplied(@event.Modification == CrabModification.Delete); }
public IEnumerable <AddressId> AddressIdsEligableToAddFor(CrabHouseNumberId houseNumberId) { if (LastSubaddressRecordsByHouseNumberId.ContainsKey(houseNumberId)) { return(LastSubaddressRecordsByHouseNumberId[houseNumberId] .Where(x => x.Modification != CrabModification.Delete && !x.EndDateTime.HasValue && !_addressIds.Contains(AddressId.CreateFor(new CrabSubaddressId(x.SubaddressId)))) .Select(x => AddressId.CreateFor(new CrabSubaddressId(x.SubaddressId)))); } return(new List <AddressId>()); }
public static ImportTerrainObjectHouseNumberFromCrab WithHouseNumberId( this ImportTerrainObjectHouseNumberFromCrab command, CrabHouseNumberId houseNumberId) { return(new ImportTerrainObjectHouseNumberFromCrab( command.CaPaKey, command.TerrainObjectHouseNumberId, command.TerrainObjectId, houseNumberId, command.Lifetime, command.Timestamp, command.Operator, command.Modification, command.Organisation)); }
private void When(TerrainObjectHouseNumberWasImportedFromCrab @event) { var crabTerrainObjectHouseNumberId = new CrabTerrainObjectHouseNumberId(@event.TerrainObjectHouseNumberId); var crabHouseNumberId = new CrabHouseNumberId(@event.HouseNumberId); if (@event.Modification == CrabModification.Delete) { _activeHouseNumberIdsByTerreinObjectHouseNr.Remove(crabTerrainObjectHouseNumberId); } else { _activeHouseNumberIdsByTerreinObjectHouseNr[crabTerrainObjectHouseNumberId] = crabHouseNumberId; } WhenCrabEventApplied(); }
public ImportHouseNumberStatusFromCrab( CrabHouseNumberStatusId houseNumberStatusId, CrabHouseNumberId houseNumberId, CrabAddressStatus addressStatus, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { HouseNumberStatusId = houseNumberStatusId; HouseNumberId = houseNumberId; AddressStatus = addressStatus; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public TerrainObjectHouseNumberWasImportedFromCrab( CrabTerrainObjectHouseNumberId terrainObjectHouseNumberId, CrabTerrainObjectId terrainObjectId, CrabHouseNumberId houseNumberId, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { TerrainObjectHouseNumberId = terrainObjectHouseNumberId; TerrainObjectId = terrainObjectId; HouseNumberId = houseNumberId; BeginDateTime = lifetime.BeginDateTime; EndDateTime = lifetime.EndDateTime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public ImportHouseNumberFromCrab( CrabHouseNumberId houseNumberId, CrabStreetNameId streetNameId, HouseNumber houseNumber, GrbNotation grbNotation, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { HouseNumberId = houseNumberId; StreetNameId = streetNameId; HouseNumber = houseNumber; GrbNotation = grbNotation; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public ImportSubaddressFromCrab( CrabSubaddressId subaddressId, CrabHouseNumberId houseNumberId, BoxNumber boxNumber, CrabBoxNumberType boxNumberType, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { SubaddressId = subaddressId; HouseNumberId = houseNumberId; BoxNumber = boxNumber; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; BoxNumberType = boxNumberType; }
public ImportTerrainObjectHouseNumberFromCrab( VbrCaPaKey caPaKey, CrabTerrainObjectHouseNumberId terrainObjectHouseNumberId, CrabTerrainObjectId terrainObjectId, CrabHouseNumberId houseNumberId, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { CaPaKey = caPaKey; TerrainObjectHouseNumberId = terrainObjectHouseNumberId; TerrainObjectId = terrainObjectId; HouseNumberId = houseNumberId; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public ImportHouseNumberMailCantonFromCrab( CrabHouseNumberMailCantonId houseNumberMailCantonId, CrabHouseNumberId houseNumberId, CrabMailCantonId mailCantonId, CrabMailCantonCode mailCantonCode, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { HouseNumberMailCantonId = houseNumberMailCantonId; HouseNumberId = houseNumberId; MailCantonId = mailCantonId; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; MailCantonCode = mailCantonCode; }
public void ImportHouseNumberFromCrab( CrabHouseNumberId houseNumberId, CrabStreetNameId crabStreetNameId, HouseNumber houseNumber, GrbNotation grbNotation, CrabLifetime crabLifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { if (IsRemoved && !IsSubaddress) { throw new AddressRemovedException($"Cannot change removed address for address id {_addressId}"); } if (!(_coupledHouseNumberId != null && _coupledHouseNumberId != houseNumberId) && !IsRemoved) { if (modification == CrabModification.Delete) { ApplyChange(new AddressWasRemoved(_addressId)); } else { ApplyHouseNumberChange(crabStreetNameId, houseNumber, modification); EvaluateRetirement(crabLifetime, modification); } } ApplyChange(new AddressHouseNumberWasImportedFromCrab( houseNumberId, crabStreetNameId, houseNumber, grbNotation, crabLifetime, timestamp, @operator, modification, organisation)); }