예제 #1
0
        public void WithCorrectedNisCode()
        {
            var importMunicipalityFromCrab = _fixture
                                             .Build <ImportMunicipalityFromCrab>()
                                             .With(x => x.PrimaryLanguage, CrabLanguage.Dutch)
                                             .With(x => x.SecondaryLanguage, (CrabLanguage?)null)
                                             .With(x => x.FacilityLanguage, (CrabLanguage?)null)
                                             .With(x => x.Lifetime, new CrabLifetime(_fixture.Create <LocalDateTime>(), null))
                                             .With(x => x.Modification, CrabModification.Correction)
                                             .With(x => x.Geometry, (WkbGeometry)null)
                                             .With(x => x.NisCode, new NisCode(_fixture.Create <string>()))
                                             .Create();

            var municipalityWasRegistered = new MunicipalityWasRegistered(_municipalityId, importMunicipalityFromCrab.NisCode);

            ((ISetProvenance)municipalityWasRegistered).SetProvenance(CreateProvenance(1));

            var municipalityNisCodeWasCorrected = new MunicipalityNisCodeWasCorrected(_municipalityId, importMunicipalityFromCrab.NisCode);

            ((ISetProvenance)municipalityNisCodeWasCorrected).SetProvenance(CreateProvenance(1));

            Assert(
                new Scenario()
                .Given(_municipalityId,
                       municipalityWasRegistered,
                       _fixture.Create <MunicipalityNisCodeWasDefined>(),
                       _fixture.Create <MunicipalityOfficialLanguageWasAdded>(),
                       _fixture.Create <MunicipalityBecameCurrent>())

                .When(importMunicipalityFromCrab)

                .Then(_municipalityId,
                      municipalityNisCodeWasCorrected,
                      importMunicipalityFromCrab.ToLegacyEvent()));
        }
 private void When(MunicipalityNisCodeWasCorrected @event)
 {
     _nisCode = new NisCode(@event.NisCode);
 }