public void ThenNoPostalCodeChangeWhenOlderLifetime( Fixture fixture, AddressId addressId, CrabLifetime lifetime, string mailCantonCode, Provenance provenance, AddressHouseNumberMailCantonWasImportedFromCrab addressHouseNumberMailCantonWasImportedFromCrab, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab) { addressHouseNumberMailCantonWasImportedFromCrab = addressHouseNumberMailCantonWasImportedFromCrab .WithBeginDate(lifetime.BeginDateTime.Value.PlusDays(1)) .WithPostalCode(mailCantonCode); importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithLifetime(lifetime); var addressPostalCodeWasChanged = new AddressPostalCodeWasChanged(addressId, new PostalCode(mailCantonCode)); ((ISetProvenance)addressPostalCodeWasChanged).SetProvenance(provenance); Assert(RegisteredAddressScenario(fixture) .Given(addressId, addressPostalCodeWasChanged, addressHouseNumberMailCantonWasImportedFromCrab) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public void WithRemovedPostalCodeWhenSameLifetimeOfPreviouslyRemovedPostalCode( Fixture fixture, AddressId addressId, CrabHouseNumberMailCantonId crabHouseNumberMailCantonId, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab, CrabLifetime lifetime ) { importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithLifetime(lifetime); Assert(RegisteredAddressScenario(fixture) .Given <AddressPostalCodeWasChanged>(addressId) .Given <AddressHouseNumberMailCantonWasImportedFromCrab>(addressId, e => e.WithBeginDate(lifetime.BeginDateTime) .WithHouseNumberMailCantonId(crabHouseNumberMailCantonId)) .Given <AddressPositionWasRemoved>(addressId) .Given <AddressHouseNumberMailCantonWasImportedFromCrab>(addressId, e => e.WithBeginDate(lifetime.BeginDateTime) .WithHouseNumberMailCantonId(crabHouseNumberMailCantonId) .WithCrabModification(CrabModification.Delete)) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, new AddressPostalCodeWasChanged(addressId, new PostalCode(importHouseNumberMailCantonFromCrab.MailCantonCode)), importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public void ThenAddressPostalCodeWasChanged( Fixture fixture, AddressId addressId, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab ) { Assert(RegisteredAddressScenario(fixture) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, new AddressPostalCodeWasChanged(addressId, new PostalCode(importHouseNumberMailCantonFromCrab.MailCantonCode)), importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public static AddressHouseNumberMailCantonWasImportedFromCrab ToLegacyEvent(this ImportHouseNumberMailCantonFromCrab command) { return(new AddressHouseNumberMailCantonWasImportedFromCrab( command.HouseNumberMailCantonId, command.HouseNumberId, command.MailCantonId, command.MailCantonCode, command.Lifetime, command.Timestamp, command.Operator, command.Modification, command.Organisation)); }
public static ImportHouseNumberMailCantonFromCrab WithLifetime(this ImportHouseNumberMailCantonFromCrab command, CrabLifetime lifetime) { return(new ImportHouseNumberMailCantonFromCrab( command.HouseNumberMailCantonId, command.HouseNumberId, command.MailCantonId, command.MailCantonCode, lifetime, command.Timestamp, command.Operator, command.Modification, command.Organisation)); }
private static void ImportHouseNumberMailCantonFromCrab(Address address, ImportHouseNumberMailCantonFromCrab message) { address.ImportHouseNumberMailCantonFromCrab( message.HouseNumberMailCantonId, message.HouseNumberId, message.MailCantonId, message.MailCantonCode, message.Lifetime, message.Timestamp, message.Operator, message.Modification, message.Organisation); }
public void ThenAddressRemovedException( AddressId addressId, AddressWasRegistered addressWasRegistered, AddressWasRemoved addressWasRemoved, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab) { Assert(new Scenario() .Given(addressId, addressWasRegistered, addressWasRemoved) .When(importHouseNumberMailCantonFromCrab) .Throws(new AddressRemovedException($"Cannot change removed address for address id {addressId}"))); }
public void WhenModificationIsCorrection( Fixture fixture, AddressId addressId, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab) { importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithCrabModification(CrabModification.Correction); Assert(RegisteredAddressScenario(fixture) .Given <AddressPostalCodeWasChanged>(addressId) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, new AddressPostalCodeWasCorrected(addressId, new PostalCode(importHouseNumberMailCantonFromCrab.MailCantonCode)), importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public void GivenCorrectedPostalCodeThenNoChangeWhenMailCantonCodeIsTheSame( Fixture fixture, AddressId addressId, AddressPostalCodeWasCorrected addressPostalCodeWasCorrected, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab ) { importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithCrabMailCantonCode(new CrabMailCantonCode(addressPostalCodeWasCorrected.PostalCode)); Assert(RegisteredAddressScenario(fixture) .Given(addressId, addressPostalCodeWasCorrected) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public void ThenAddressPostalCodeWasChangedWhenNewerLifetime( Fixture fixture, AddressId addressId, CrabLifetime lifetime, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab ) { importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithLifetime(lifetime); Assert(RegisteredAddressScenario(fixture) .Given <AddressPostalCodeWasChanged>(addressId) .Given <AddressHouseNumberMailCantonWasImportedFromCrab>(addressId, e => e.WithBeginDate(lifetime.BeginDateTime.Value.PlusDays(-1))) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, new AddressPostalCodeWasChanged(addressId, new PostalCode(importHouseNumberMailCantonFromCrab.MailCantonCode)), importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }
public void ThenAddressPostalCodeWasRemovedWhenModificationIsDelete( Fixture fixture, AddressId addressId, AddressPostalCodeWasChanged addressPostalCodeWasChanged, AddressHouseNumberMailCantonWasImportedFromCrab addressHouseNumberMailCantonWasImportedFromCrab, ImportHouseNumberMailCantonFromCrab importHouseNumberMailCantonFromCrab ) { importHouseNumberMailCantonFromCrab = importHouseNumberMailCantonFromCrab .WithCrabModification(CrabModification.Delete) .WithCrabMailCantonCode(new CrabMailCantonCode(addressPostalCodeWasChanged.PostalCode)); addressHouseNumberMailCantonWasImportedFromCrab = addressHouseNumberMailCantonWasImportedFromCrab .WithCrabModification(CrabModification.Insert) .WithHouseNumberMailCantonId(importHouseNumberMailCantonFromCrab.HouseNumberMailCantonId) .WithPostalCode(addressPostalCodeWasChanged.PostalCode); Assert(RegisteredAddressScenario(fixture) .Given(addressId, addressPostalCodeWasChanged, addressHouseNumberMailCantonWasImportedFromCrab) .When(importHouseNumberMailCantonFromCrab) .Then(addressId, new AddressPostalCodeWasRemoved(addressId), importHouseNumberMailCantonFromCrab.ToLegacyEvent())); }