예제 #1
0
        public void WithFiniteLifeTimeAndCorrectionAndMunicipalityIsCurrent()
        {
            var retirementDate    = _fixture.Create <LocalDateTime>();
            var retirementInstant = retirementDate.ToCrabInstant();

            var importMunicipalityFromCrab = _fixture
                                             .Build <ImportMunicipalityFromCrab>()
                                             .With(x => x.PrimaryLanguage, CrabLanguage.Dutch)
                                             .With(x => x.Modification, CrabModification.Correction)
                                             .With(x => x.SecondaryLanguage, (CrabLanguage?)null)
                                             .With(x => x.FacilityLanguage, (CrabLanguage?)null)
                                             .With(x => x.Geometry, (WkbGeometry)null)
                                             .With(x => x.Lifetime, new CrabLifetime(_fixture.Create <LocalDateTime>(), retirementDate))
                                             .Create();

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

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

            var municipalityWasCorrectedToRetired = new MunicipalityWasCorrectedToRetired(_municipalityId, new RetirementDate(retirementInstant));

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

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

                .When(importMunicipalityFromCrab)

                .Then(_municipalityId,
                      municipalityWasCorrectedToRetired,
                      importMunicipalityFromCrab.ToLegacyEvent()));
        }
 private void When(MunicipalityWasCorrectedToRetired @event)
 {
     _status      = MunicipalityStatus.Retired;
     _retiredDate = new RetirementDate(@event.RetirementDate);
 }