Exemple #1
0
        public void With2LanguagesAndInfiniteLifeTime()
        {
            var importMunicipalityFromCrab = _fixture
                                             .Build <ImportMunicipalityFromCrab>()
                                             .With(x => x.PrimaryLanguage, CrabLanguage.Dutch)
                                             .With(x => x.SecondaryLanguage, CrabLanguage.French)
                                             .With(x => x.FacilityLanguage, (CrabLanguage?)null)
                                             .With(x => x.Lifetime, new CrabLifetime(_fixture.Create <LocalDateTime>(), null))
                                             .With(x => x.Geometry, new WkbGeometry(GeometryHelpers.ExampleWkb))
                                             .Create();

            var provenance = new MunicipalityProvenanceFactory().CreateFrom(1, false, importMunicipalityFromCrab.Timestamp, importMunicipalityFromCrab.Modification, importMunicipalityFromCrab.Operator, importMunicipalityFromCrab.Organisation);

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

            ((ISetProvenance)municipalityWasRegistered).SetProvenance(provenance);

            var municipalityBecameCurrent = new MunicipalityBecameCurrent(_municipalityId);

            ((ISetProvenance)municipalityBecameCurrent).SetProvenance(provenance);

            var municipalityOfficialLanguageWasAdded = new MunicipalityOfficialLanguageWasAdded(_municipalityId, Language.Dutch);

            ((ISetProvenance)municipalityOfficialLanguageWasAdded).SetProvenance(provenance);

            var municipalitySecondOfficialLanguageWasAdded = new MunicipalityOfficialLanguageWasAdded(_municipalityId, Language.French);

            ((ISetProvenance)municipalitySecondOfficialLanguageWasAdded).SetProvenance(provenance);

            var municipalityWasDrawn = new MunicipalityWasDrawn(_municipalityId, new ExtendedWkbGeometry(GeometryHelpers.ExampleExtendedWkb));

            ((ISetProvenance)municipalityWasDrawn).SetProvenance(provenance);

            Assert(
                new Scenario()
                .Given(_municipalityId,
                       municipalityWasRegistered)

                .When(importMunicipalityFromCrab)

                .Then(_municipalityId,
                      municipalityOfficialLanguageWasAdded,
                      municipalitySecondOfficialLanguageWasAdded,
                      municipalityWasDrawn,
                      municipalityBecameCurrent,
                      importMunicipalityFromCrab.ToLegacyEvent()));
        }
Exemple #2
0
        public void WithNewGeometryAsNullAndCorrection()
        {
            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.Lifetime, new CrabLifetime(_fixture.Create <LocalDateTime>(), null))
                                             .With(x => x.Geometry, (WkbGeometry)null)
                                             .Create();

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

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

            var municipalityGeometryWasCorrectedToCleared = new MunicipalityGeometryWasCorrectedToCleared(_municipalityId);

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

            var municipalityWasDrawn = new MunicipalityWasDrawn(_municipalityId, new ExtendedWkbGeometry(GeometryHelpers.ExampleExtendedWkb));

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

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

                .When(importMunicipalityFromCrab)

                .Then(_municipalityId,
                      municipalityGeometryWasCorrectedToCleared,
                      importMunicipalityFromCrab.ToLegacyEvent()));
        }
        public void ThenMunicipalityIsRegistered()
        {
            var municipalityWasRegistered = new MunicipalityWasRegistered(_municipalityId, _importMunicipalityFromCrab.NisCode);

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

            var municipalityOfficialLanguageWasAdded = new MunicipalityOfficialLanguageWasAdded(_municipalityId, Language.Dutch);

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

            var municipalitySecondOfficialLanguageWasAdded = new MunicipalityOfficialLanguageWasAdded(_municipalityId, Language.French);

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

            var facilityLanguageWasAdded = new MunicipalityFacilityLanguageWasAdded(_municipalityId, Language.English);

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

            var municipalityWasDrawn = new MunicipalityWasDrawn(_municipalityId, new ExtendedWkbGeometry(GeometryHelpers.ExampleExtendedWkb));

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

            var municipalityBecameCurrent = new MunicipalityBecameCurrent(_municipalityId);

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

            Assert(
                new Scenario()
                .GivenNone()
                .When(_importMunicipalityFromCrab)
                .Then(_municipalityId,
                      municipalityWasRegistered,
                      municipalityOfficialLanguageWasAdded,
                      municipalitySecondOfficialLanguageWasAdded,
                      facilityLanguageWasAdded,
                      municipalityWasDrawn,
                      municipalityBecameCurrent,
                      _importMunicipalityFromCrab.ToLegacyEvent()));
        }
 private void When(MunicipalityWasDrawn @event)
 {
     _geometry = new ExtendedWkbGeometry(@event.ExtendedWkbGeometry.ToByteArray());
 }