public ImportStreetNameFromCrab( CrabStreetNameId streetNameId, CrabMunicipalityId municipalityId, NisCode nisCode, CrabStreetName primaryStreetName, CrabStreetName secondaryStreetName, CrabTransStreetName primaryTransStreetName, CrabTransStreetName secondaryTransStreetName, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabLifetime lifeTime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { StreetNameId = streetNameId; MunicipalityId = municipalityId; NisCode = nisCode; PrimaryStreetName = primaryStreetName; SecondaryStreetName = secondaryStreetName; PrimaryTransStreetName = primaryTransStreetName; SecondaryTransStreetName = secondaryTransStreetName; PrimaryLanguage = primaryLanguage; SecondaryLanguage = secondaryLanguage; LifeTime = lifeTime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public StreetNameWasImportedFromCrab( CrabStreetNameId streetNameId, CrabMunicipalityId municipalityId, CrabStreetName primaryStreetName, CrabStreetName secondaryStreetName, CrabTransStreetName primaryTransStreetName, CrabTransStreetName secondaryTransStreetName, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabTimestamp timestamp, CrabLifetime lifetime, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { StreetNameId = streetNameId; MunicipalityId = municipalityId; PrimaryStreetName = primaryStreetName?.Name; SecondaryStreetName = secondaryStreetName?.Name; PrimaryTransStreetName = primaryTransStreetName?.TransStreetName; SecondaryTransStreetName = secondaryTransStreetName?.TransStreetName; PrimaryLanguage = primaryLanguage; SecondaryLanguage = secondaryLanguage; Timestamp = timestamp; BeginDateTime = lifetime.BeginDateTime; EndDateTime = lifetime.EndDateTime; Operator = @operator; Modification = modification; Organisation = organisation; }
protected StreetName Act(StreetName sut, CrabStreetNameId CrabStreetNameId, CrabMunicipalityId crabMunicipalityId, CrabStreetName primaryStreetName, CrabStreetName secondaryStreetName, CrabTransStreetName primaryTransStreetName, CrabTransStreetName secondaryTransStreetName, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabLifetime lifetime, CrabTimestamp crabTimestamp, CrabOperator beginOperator, CrabModification?modification, CrabOrganisation?beginOrganisation) { LogAct($"ImportFromCrab({CrabStreetNameId},{crabMunicipalityId},{primaryStreetName},{secondaryStreetName},{secondaryTransStreetName},{primaryTransStreetName},{primaryLanguage},{secondaryLanguage},{lifetime},{crabTimestamp},{beginOperator},{modification},{beginOrganisation})"); sut.ImportFromCrab(CrabStreetNameId, crabMunicipalityId, primaryStreetName, secondaryStreetName, primaryTransStreetName, secondaryTransStreetName, primaryLanguage, secondaryLanguage, lifetime, crabTimestamp, beginOperator, modification, beginOrganisation); return(sut); }
public ImportMunicipalityFromCrab( NisCode nisCode, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabLanguage?facilityLanguage, WkbGeometry geometry, NumberOfFlags numberOfFlags, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation, CrabMunicipalityId municipalityId) { NisCode = nisCode; PrimaryLanguage = primaryLanguage; SecondaryLanguage = secondaryLanguage; FacilityLanguage = facilityLanguage; Geometry = geometry; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; NumberOfFlags = numberOfFlags; MunicipalityId = municipalityId; }
public MunicipalityWasImportedFromCrab( CrabMunicipalityId crabMunicipalityId, NisCode nisCode, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, NumberOfFlags numberOfFlags, CrabLifetime lifetime, WkbGeometry wkbGeometry, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { CrabMunicipalityId = crabMunicipalityId; NisCode = nisCode; PrimaryLanguage = primaryLanguage; SecondaryLanguage = secondaryLanguage; NumberOfFlags = numberOfFlags; BeginDate = lifetime.BeginDateTime; EndDate = lifetime.EndDateTime; WkbGeometry = wkbGeometry?.ToString(); Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public void ImportFromCrab( CrabStreetNameId streetNameId, CrabMunicipalityId municipalityId, CrabStreetName primaryStreetName, CrabStreetName secondaryStreetName, CrabTransStreetName primaryTransStreetName, CrabTransStreetName secondaryTransStreetName, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabLifetime lifeTime, CrabTimestamp timestamp, CrabOperator beginOperator, CrabModification?beginModification, CrabOrganisation?beginOrganisation) { if (IsRemoved) { throw new InvalidOperationException($"Cannot change removed street name for street name id {_streetNameId}/{streetNameId}"); } if (beginModification == CrabModification.Delete) { ApplyChange(new StreetNameWasRemoved(_streetNameId)); } else { ApplyRetiredOrUnretire(lifeTime, beginModification); if (beginModification != CrabModification.Correction) { ApplyNameChanges(primaryStreetName, secondaryStreetName); ApplyLanguageChanges(primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage()); } else { ApplyNameCorrections(primaryStreetName, secondaryStreetName); ApplyLanguageCorrections(primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage()); } } AssignPersistentLocalId(new PersistentLocalId(streetNameId), new PersistentLocalIdAssignmentDate(timestamp)); ApplyChange(new StreetNameWasImportedFromCrab( streetNameId, municipalityId, primaryStreetName, secondaryStreetName, primaryTransStreetName, secondaryTransStreetName, primaryLanguage, secondaryLanguage, timestamp, lifeTime, beginOperator, beginModification, beginOrganisation)); }
public async Task Given_MunicipalityWasNamed_twice_and_municipality_was_registered_Then_expected_item_is_updated() { var projection = new MunicipalityListProjections(); var resolver = ConcurrentResolve.WhenEqualToHandlerMessageType(projection.Handlers); var crabMunicipalityId = new CrabMunicipalityId(1); var municipalityId = MunicipalityId.CreateFor(crabMunicipalityId); var nisCode = "456"; var municipalityWasRegistered = new MunicipalityWasRegistered(municipalityId, new NisCode(nisCode)); ((ISetProvenance)municipalityWasRegistered).SetProvenance(_provenance); var municipalityWasNamed = new MunicipalityWasNamed(municipalityId, new MunicipalityName("test", Language.Dutch)); ((ISetProvenance)municipalityWasNamed).SetProvenance(_provenance); var wasNamed = new MunicipalityWasNamed(municipalityId, new MunicipalityName("test21", Language.French)); ((ISetProvenance)wasNamed).SetProvenance(_provenance); await new ConnectedProjectionScenario <LegacyContext>(resolver) .Given( new Envelope <MunicipalityWasRegistered>(new Envelope( municipalityWasRegistered, EmptyMetadata)), new Envelope <MunicipalityWasNamed>(new Envelope( municipalityWasNamed, EmptyMetadata)), new Envelope <MunicipalityWasNamed>(new Envelope( wasNamed, EmptyMetadata))) .Verify(async context => { var municipality = await context.MunicipalityList.FirstAsync(a => a.MunicipalityId == municipalityId); municipality.MunicipalityId.Should().Be((Guid)municipalityId); municipality.NameDutch.Should().Be("test"); municipality.NameFrench.Should().Be("test21"); return(VerificationResult.Pass()); }) .Assert(); }
public ImportMunicipalityNameFromCrab( CrabMunicipalityId municipalityId, CrabMunicipalityName municipalityName, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation, CrabMunicipalityNameId municipalityNameId) { MunicipalityId = municipalityId; MunicipalityName = municipalityName; Lifetime = lifetime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; MunicipalityNameId = municipalityNameId; }
public MunicipalityNameWasImportedFromCrab( CrabMunicipalityId crabMunicipalityId, CrabMunicipalityNameId crabMunicipalityNameId, CrabMunicipalityName municipalityName, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { CrabMunicipalityId = crabMunicipalityId; CrabMunicipalityNameId = crabMunicipalityNameId; MunicipalityNameName = municipalityName?.Name; MunicipalityNameLanguage = municipalityName?.Language; BeginDateTime = lifetime.BeginDateTime; EndDateTime = lifetime.EndDateTime; Timestamp = timestamp; Operator = @operator; Modification = modification; Organisation = organisation; }
public void ImportNameFromCrab( CrabMunicipalityId crabMunicipalityId, CrabMunicipalityNameId crabMunicipalityNameId, CrabMunicipalityName municipalityName, CrabLifetime lifetime, CrabTimestamp timestamp, CrabOperator @operator, CrabModification?modification, CrabOrganisation?organisation) { CheckChangedName(municipalityName.Language?.ToLanguage(), municipalityName.Name, modification); // Legacy Event ApplyChange(new MunicipalityNameWasImportedFromCrab( crabMunicipalityId, crabMunicipalityNameId, municipalityName, lifetime, timestamp, @operator, modification, organisation)); }
public async Task Given_MunicipalityDefinedNisCode_Then_nisCode_should_be_changed() { var projection = new MunicipalityListProjections(); var resolver = ConcurrentResolve.WhenEqualToHandlerMessageType(projection.Handlers); var crabMunicipalityId = new CrabMunicipalityId(1); var municipalityId = MunicipalityId.CreateFor(crabMunicipalityId); var nisCode = "456"; var municipalityWasRegistered = new MunicipalityWasRegistered(municipalityId, new NisCode(nisCode)); ((ISetProvenance)municipalityWasRegistered).SetProvenance(_provenance); var municipalityNisCodeWasDefined = new MunicipalityNisCodeWasDefined(municipalityId, new NisCode(nisCode)); ((ISetProvenance)municipalityNisCodeWasDefined).SetProvenance(_provenance); await new ConnectedProjectionScenario <LegacyContext>(resolver) .Given( new Envelope <MunicipalityWasRegistered>(new Envelope( municipalityWasRegistered, EmptyMetadata)), new Envelope <MunicipalityNisCodeWasDefined>(new Envelope( municipalityNisCodeWasDefined, EmptyMetadata))) .Verify(async context => { var municipality = await context.MunicipalityList.FirstAsync(a => a.NisCode == nisCode); municipality.MunicipalityId.Should().Be((Guid)municipalityId); municipality.NisCode.Should().Be(nisCode); return(VerificationResult.Pass()); }) .Assert(); }
public async Task Given_MunicipalityDefinedPrimaryLanguage_Then_expected_item_is_updated() { var projection = new MunicipalityListProjections(); var resolver = ConcurrentResolve.WhenEqualToHandlerMessageType(projection.Handlers); var crabMunicipalityId = new CrabMunicipalityId(1); var municipalityId = MunicipalityId.CreateFor(crabMunicipalityId); var nisCode = "456"; var municipalityWasRegistered = new MunicipalityWasRegistered(municipalityId, new NisCode(nisCode)); ((ISetProvenance)municipalityWasRegistered).SetProvenance(_provenance); var municipalityOfficialLanguageWasAdded = new MunicipalityOfficialLanguageWasAdded(municipalityId, Language.Dutch); ((ISetProvenance)municipalityOfficialLanguageWasAdded).SetProvenance(_provenance); await new ConnectedProjectionScenario <LegacyContext>(resolver) .Given( new Envelope <MunicipalityWasRegistered>(new Envelope( municipalityWasRegistered, EmptyMetadata)), new Envelope <MunicipalityOfficialLanguageWasAdded>(new Envelope( municipalityOfficialLanguageWasAdded, EmptyMetadata))) .Verify(async context => { var municipality = await context.MunicipalityList.FirstAsync(a => a.MunicipalityId == municipalityId); municipality.MunicipalityId.Should().Be((Guid)municipalityId); municipality.OfficialLanguages.Should().AllBeEquivalentTo(Language.Dutch); return(VerificationResult.Pass()); }) .Assert(); }
public void ImportFromCrab( CrabMunicipalityId crabMunicipalityId, NisCode nisCode, CrabLanguage?primaryLanguage, CrabLanguage?secondaryLanguage, CrabLanguage?facilityLanguage, NumberOfFlags numberOfFlags, CrabLifetime crabLifetime, WkbGeometry geometry, CrabTimestamp crabTimestamp, CrabOperator crabOperator, CrabModification?crabModification, CrabOrganisation?crabOrganisation) { var endTime = crabLifetime?.EndDateTime; CheckChangedNisCode(nisCode, crabModification); CheckChangedOfficialLanguages(new[] { primaryLanguage?.ToLanguage(), secondaryLanguage?.ToLanguage() }); CheckChangedFacilityLanguages(facilityLanguage?.ToLanguage()); CheckChangedGeometry(geometry == null ? null : geometry, crabModification); CheckChangedStatus(endTime, crabModification); // Legacy Event ApplyChange(new MunicipalityWasImportedFromCrab( crabMunicipalityId, nisCode, primaryLanguage, secondaryLanguage, numberOfFlags, crabLifetime, geometry, crabTimestamp, crabOperator, crabModification, crabOrganisation)); }
public static MunicipalityId CreateFor(CrabMunicipalityId crabMunicipalityId) => new MunicipalityId(crabMunicipalityId.CreateDeterministicId());