private IEventCentricTestSpecificationBuilder Scenario6(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3,
                                                                WkbGeometry geometry4)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(5790888),
                crabHouseNumberId,
                geometry4,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2015, 7, 30, 10, 57, 33, 273, TimeSpan.Zero))),
                new CrabOperator("13040:7405:DAERO"),
                CrabModification.Insert,
                Enum.Parse <CrabOrganisation>("5"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario5(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         command.ToLegacyEvent()));
        }
Example #2
0
        public void ThenNoPositionChangeWhenOlderLifetimeAndLessQuality(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImportedFromCrab,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            addressHouseNumberPositionWasImportedFromCrab = addressHouseNumberPositionWasImportedFromCrab
                                                            .WithWkbGeometry(wkbGeometry)
                                                            .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromStand);

            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                .WithLifetime(new CrabLifetime(addressHouseNumberPositionWasImportedFromCrab.BeginDateTime.Value.PlusDays(-1),
                                                                               addressHouseNumberPositionWasImportedFromCrab.EndDateTime));

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImportedFromCrab)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
Example #3
0
        public void WhenModificationIsCorrection(
            Fixture fixture,
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            WkbGeometry wkbGeometry,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabModification(CrabModification.Correction)
                                                .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromBuilding);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned
                          )
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressPositionWasCorrected(addressId,
                                                         new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
Example #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((AddressId.GetHashCode() * 397) ^ NextChargeScheduledAt.GetHashCode());
     }
 }
 public AddressHouseNumberWasCorrected(
     AddressId addressId,
     HouseNumber houseNumber)
 {
     AddressId   = addressId;
     HouseNumber = houseNumber;
 }
 public AddressBoxNumberWasCorrected(
     AddressId addressId,
     BoxNumber boxNumber)
 {
     AddressId = addressId;
     BoxNumber = boxNumber;
 }
Example #7
0
        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 AddressPostalCodeWasChanged(
     AddressId addressId,
     PostalCode postalCode)
 {
     AddressId  = addressId;
     PostalCode = postalCode;
 }
Example #9
0
        public void WithNoDeleteAndFiniteLifetime()
        {
            var command = Fixture.Create <ImportTerrainObjectHouseNumberFromCrab>();

            var subaddress1 = Fixture.Create <ImportSubaddressFromCrab>()
                              .WithLifetime(new CrabLifetime(Fixture.Create <LocalDateTime>(), null))
                              .WithHouseNumberId(command.HouseNumberId);

            var subaddress2 = Fixture.Create <ImportSubaddressFromCrab>()
                              .WithLifetime(new CrabLifetime(Fixture.Create <LocalDateTime>(), null))
                              .WithHouseNumberId(command.HouseNumberId);

            Assert(new Scenario()
                   .Given(_parcelId,
                          Fixture.Create <ParcelWasRegistered>(),
                          Fixture.Create <ParcelAddressWasAttached>()
                          .WithAddressId(AddressId.CreateFor(command.HouseNumberId)),
                          command.ToLegacyEvent(),
                          Fixture.Create <ParcelAddressWasAttached>()
                          .WithAddressId(AddressId.CreateFor(subaddress1.SubaddressId)),
                          subaddress1.ToLegacyEvent(),
                          Fixture.Create <ParcelAddressWasAttached>()
                          .WithAddressId(AddressId.CreateFor(subaddress2.SubaddressId)),
                          subaddress2.ToLegacyEvent())
                   .When(command)
                   .Then(_parcelId,
                         new ParcelAddressWasDetached(_parcelId, AddressId.CreateFor(subaddress1.SubaddressId)),
                         new ParcelAddressWasDetached(_parcelId, AddressId.CreateFor(subaddress2.SubaddressId)),
                         new ParcelAddressWasDetached(_parcelId, AddressId.CreateFor(command.HouseNumberId)),
                         command.ToLegacyEvent()));
        }
        public async Task AddressPositionWasRemovedSetsPositionToNull(
            AddressId addressId,
            WkbGeometry geometry,
            Provenance provenance,
            AddressWasRegistered addressWasRegistered,
            AddressPositionWasRemoved addressPositionWasRemoved)
        {
            var addressPositionWasCorrected =
                new AddressPositionWasCorrected(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(geometry)));

            ((ISetProvenance)addressPositionWasCorrected).SetProvenance(provenance);

            await Assert(
                Given(addressWasRegistered,
                      addressPositionWasCorrected, addressPositionWasRemoved)
                .Expect(ctx => ctx.AddressDetail, new AddressDetailItem
            {
                AddressId             = addressWasRegistered.AddressId,
                StreetNameId          = addressWasRegistered.StreetNameId,
                HouseNumber           = addressWasRegistered.HouseNumber,
                Position              = null,
                PositionSpecification = null,
                PositionMethod        = null,
                VersionTimestamp      = addressPositionWasRemoved.Provenance.Timestamp
            }));
        }
        public async Task AddressWasPositionedSetsPosition(
            AddressId addressId,
            WkbGeometry geometry,
            Provenance provenance,
            AddressWasRegistered addressWasRegistered)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.Interpolated, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(provenance);

            await Assert(
                Given(addressWasRegistered, addressWasPositioned)
                .Expect(
                    new AddressComparer <AddressDetailItem>(),
                    ctx => ctx.AddressDetail,
                    new AddressDetailItem
            {
                AddressId             = addressWasRegistered.AddressId,
                StreetNameId          = addressWasRegistered.StreetNameId,
                HouseNumber           = addressWasRegistered.HouseNumber,
                Position              = addressWasPositioned.ExtendedWkbGeometry.ToByteArray(),
                PositionMethod        = addressWasPositioned.GeometryMethod,
                PositionSpecification = addressWasPositioned.GeometrySpecification,
                VersionTimestamp      = addressWasPositioned.Provenance.Timestamp
            }));
        }
Example #12
0
        public void WhenDeleteAndInfiniteLifetimeWithAddress()
        {
            var command = _fixture.Create <ImportTerrainObjectHouseNumberFromCrab>()
                          .WithLifetime(new CrabLifetime(_fixture.Create <LocalDateTime>(), null))
                          .WithModification(CrabModification.Insert);

            var deleteCommand = _fixture.Create <ImportTerrainObjectHouseNumberFromCrab>()
                                .WithLifetime(new CrabLifetime(_fixture.Create <LocalDateTime>(), null))
                                .WithTerrainObjectHouseNumberId(command.TerrainObjectHouseNumberId)
                                .WithHouseNumberId(command.HouseNumberId)
                                .WithModification(CrabModification.Delete);

            var addressId = AddressId.CreateFor(command.HouseNumberId);

            Assert(new Scenario()
                   .Given(_parcelId,
                          _fixture.Create <ParcelWasRegistered>(),
                          _fixture.Create <ParcelAddressWasAttached>()
                          .WithAddressId(addressId),
                          command.ToLegacyEvent())
                   .When(deleteCommand)
                   .Then(_parcelId,
                         new ParcelAddressWasDetached(_parcelId, addressId),
                         deleteCommand.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario1(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var addressWasRegistered = new AddressWasRegistered(
                addressId,
                fixture.Create <StreetNameId>(),
                fixture.Create <HouseNumber>());

            ((ISetProvenance)addressWasRegistered).SetProvenance(fixture.Create <Provenance>());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(1),
                crabHouseNumberId,
                geometry,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("10"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2011, 4, 29, 14, 50, 10, 483, TimeSpan.Zero))),
                new CrabOperator("VLM\\thijsge"),
                CrabModification.Insert,
                Enum.Parse <CrabOrganisation>("5"));

            return(new Scenario()
                   .Given(addressId, addressWasRegistered)
                   .When(command)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry))),
                         command.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario7(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3,
                                                                WkbGeometry geometry4)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(4087928),
                crabHouseNumberId,
                geometry3,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2015, 7, 30, 10, 57, 33, 920, TimeSpan.Zero))),
                new CrabOperator("13040:7405:DAERO"),
                CrabModification.Delete,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario6(fixture, crabHouseNumberId, geometry1, geometry2, geometry3, geometry4))
                   .When(command)
                   .Then(addressId,
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.BuildingUnit, GeometryHelpers.CreateEwkbFrom(geometry4))),
                         command.ToLegacyEvent()));
        }
Example #15
0
 public AddressStreetNameWasChanged(
     AddressId addressId,
     StreetNameId streetNameId)
 {
     AddressId    = addressId;
     StreetNameId = streetNameId;
 }
Example #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ChargeStatus != null ? ChargeStatus.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PaymentProcessor != null ? PaymentProcessor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AddressIsActive.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ChargeId.GetHashCode();
         hashCode = (hashCode * 397) ^ AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShopifyId != null ? ShopifyId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShopifyOrderId != null ? ShopifyOrderId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyOrderNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShopifyCartToken != null ? ShopifyCartToken.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShippingDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ShippedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ProcessedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsPrepaid.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalPrice != null ? TotalPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #17
0
        public void WhenPositionQualityIsHigher(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImported,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, new ExtendedWkbGeometry(addressSubaddressPositionWasImported.AddressPosition)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            addressSubaddressPositionWasImported = addressSubaddressPositionWasImported
                                                   .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                   .WithBeginDate(crabLifetime.BeginDateTime);

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromEntryOfBuilding)
                                               .WithLifetime(crabLifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImported)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(importSubaddressPositionFromCrab.AddressPosition))),
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Example #18
0
        public async Task <IActionResult> UpdateAddressAsync(AddressId addressId, [FromBody] UpdateAddressRequest request)
        {
            var user = await _userService.GetUserAsync(User);

            var address = await _addressService.FindUserAddressAsync(user, addressId);

            if (address == null)
            {
                return(this.NotFound("Address not found."));
            }

            var result = await _addressService.UpdateAddressAsync(
                address,
                request.Line1,
                request.Line2,
                request.City,
                request.State,
                request.PostalCode);

            if (result.IsValid)
            {
                return(this.Ok(_mapper.Map <AddressDto>(result.Response)));
            }

            result.AddToModelState(ModelState);

            return(this.BadRequest(new ValidationProblemDetails(ModelState)));
        }
Example #19
0
        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()));
        }
Example #20
0
 public Address(string name, string path, bool isSingleUrl)
 {
     Name        = name ?? throw new ArgumentNullException(nameof(name));
     Path        = path ?? throw new ArgumentNullException(nameof(path));
     IsSingleUrl = isSingleUrl;
     Id          = AddressId.NewId();
 }
        public void AddTerrainObjectHouseNumber_BasedOnSnapshot()
        {
            var command = Fixture.Create <ImportSubaddressFromCrab>()
                          .WithLifetime(new CrabLifetime(Fixture.Create <LocalDateTime>(), null))
                          .WithModification(CrabModification.Insert);

            var terrainObjectHouseNumberWasImportedFromCrab = Fixture.Create <ImportTerrainObjectHouseNumberFromCrab>()
                                                              .WithHouseNumberId(command.HouseNumberId)
                                                              .ToLegacyEvent();

            Assert(new Scenario()
                   .Given(_parcelId, Fixture.Create <ParcelWasRegistered>())
                   .Given(_snapshotId,
                          SnapshotBuilder.CreateDefaultSnapshot(_parcelId)
                          .WithAddressIds(new[] { AddressId.CreateFor(command.HouseNumberId) })
                          .WithActiveHouseNumberIdsByTerrainObjectHouseNr(new Dictionary <CrabTerrainObjectHouseNumberId, CrabHouseNumberId>()
            {
                { new CrabTerrainObjectHouseNumberId(terrainObjectHouseNumberWasImportedFromCrab.TerrainObjectHouseNumberId), new CrabHouseNumberId(terrainObjectHouseNumberWasImportedFromCrab.HouseNumberId) }
            })
                          .WithIsRemoved(true)
                          .Build(3, EventSerializerSettings)
                          )
                   .When(command)
                   .Throws(new ParcelRemovedException($"Cannot change removed parcel for parcel id {_parcelId}")));
        }
Example #22
0
 public AddressStreetNameWasCorrected(
     AddressId addressId,
     StreetNameId streetNameId)
 {
     StreetNameId = streetNameId;
     AddressId    = addressId;
 }
Example #23
0
        public void WhenDeleteAndInfiniteLifetimeWithAddress_WithSnapshot()
        {
            Fixture.Register(() => (ISnapshotStrategy)IntervalStrategy.SnapshotEvery(1));

            var command = Fixture.Create <ImportTerrainObjectHouseNumberFromCrab>()
                          .WithLifetime(new CrabLifetime(Fixture.Create <LocalDateTime>(), null))
                          .WithModification(CrabModification.Insert);

            var deleteCommand = Fixture.Create <ImportTerrainObjectHouseNumberFromCrab>()
                                .WithLifetime(new CrabLifetime(Fixture.Create <LocalDateTime>(), null))
                                .WithTerrainObjectHouseNumberId(command.TerrainObjectHouseNumberId)
                                .WithHouseNumberId(command.HouseNumberId)
                                .WithModification(CrabModification.Delete);

            var addressId = AddressId.CreateFor(command.HouseNumberId);

            Assert(new Scenario()
                   .Given(_parcelId,
                          Fixture.Create <ParcelWasRegistered>(),
                          Fixture.Create <ParcelAddressWasAttached>()
                          .WithAddressId(addressId),
                          command.ToLegacyEvent())
                   .When(deleteCommand)
                   .Then(new[]
            {
                new Fact(_parcelId, new ParcelAddressWasDetached(_parcelId, addressId)),
                new Fact(_parcelId, deleteCommand.ToLegacyEvent()),
                new Fact(_snapshotId,
                         SnapshotBuilder.CreateDefaultSnapshot(_parcelId)
                         .WithLastModificationBasedOnCrab(Modification.Update)
                         .Build(4, EventSerializerSettings))
            }));
        }
 public AssignPersistentLocalIdToAddress(
     AddressId addressId,
     PersistentLocalId persistentLocalId)
 {
     AddressId         = addressId;
     PersistentLocalId = persistentLocalId;
 }
Example #25
0
        public void Configure(EntityTypeBuilder <Address> builder)
        {
            builder.Property(address => address.Id)
            .HasConversion(addressId => addressId.ToGuid(), value => AddressId.FromGuid(value))
            .IsRequired()
            .ValueGeneratedNever();

            builder.Property(address => address.Type)
            .HasConversion(type => type != null ? type.Value : (int?)null, type => type.HasValue ? AddressType.FromValue(type.Value) : null)
            .IsRequired(false);

            builder.Property(address => address.Country).HasConversion(country => country.Name, name => Country.FromName(name)).IsRequired();

            builder.Property(address => address.Line1).IsRequired();

            builder.Property(address => address.Line2).IsRequired(false);

            builder.Property(address => address.City).IsRequired();

            builder.Property(address => address.State).IsRequired(false);

            builder.Property(address => address.PostalCode).IsRequired(false);

            builder.Property(address => address.UserId).IsRequired();

            builder.HasKey(address => address.Id);

            builder.ToTable("Address");
        }
Example #26
0
 public AddressHouseNumberWasChanged(
     AddressId addressId,
     HouseNumber houseNumber)
 {
     AddressId   = addressId;
     HouseNumber = houseNumber;
 }
Example #27
0
        public void ThenPositionChangeWhenOlderLifetimeAndHigherQuality(
            Fixture fixture,
            AddressId addressId,
            WkbGeometry wkbGeometry,
            CrabLifetime lifetime,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressGeometry = new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, GeometryHelpers.CreateEwkbFrom(wkbGeometry));

            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromStand)
                                                .WithLifetime(lifetime);

            Assert(RegisteredAddressScenario(fixture)
                   .Given <AddressWasPositioned>(addressId, e => e.WithAddressGeometry(addressGeometry))
                   .Given <AddressHouseNumberPositionWasImportedFromCrab>(addressId, e => e
                                                                          .WithWkbGeometry(wkbGeometry)
                                                                          .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                                          .WithBeginDate(lifetime.BeginDateTime.Value.PlusDays(1)))
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         new AddressWasPositioned(addressId,
                                                  new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Stand, GeometryHelpers.CreateEwkbFrom(importHouseNumberPositionFromCrab.AddressPosition))),
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
Example #28
0
        public void ThenAddressBecameIncompleteWhenModificationIsDelete(
            AddressId addressId,
            AddressWasRegistered addressWasRegistered,
            AddressWasProposed addressWasProposed,
            AddressWasOfficiallyAssigned addressWasOfficiallyAssigned,
            AddressWasPositioned addressWasPositioned,
            AddressBecameComplete addressBecameComplete,
            ImportHouseNumberStatusFromCrab importHouseNumberStatusFromCrab)
        {
            importHouseNumberStatusFromCrab = importHouseNumberStatusFromCrab.WithCrabModification(CrabModification.Delete);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasProposed,
                          addressWasOfficiallyAssigned,
                          addressWasPositioned,
                          addressBecameComplete)
                   .When(importHouseNumberStatusFromCrab)
                   .Then(addressId,
                         new AddressStatusWasRemoved(addressId),
                         new AddressOfficialAssignmentWasRemoved(addressId),
                         new AddressBecameIncomplete(addressId),
                         importHouseNumberStatusFromCrab.ToLegacyEvent()));
        }
Example #29
0
        public void WhenPositionQualityIsLower(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImported,
            ImportHouseNumberPositionFromCrab importHouseNumberPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot, new ExtendedWkbGeometry(addressHouseNumberPositionWasImported.AddressPosition)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());

            addressHouseNumberPositionWasImported = addressHouseNumberPositionWasImported
                                                    .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromLot)
                                                    .WithBeginDate(crabLifetime.BeginDateTime);

            importHouseNumberPositionFromCrab = importHouseNumberPositionFromCrab
                                                .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                                .WithLifetime(crabLifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressHouseNumberPositionWasImported)
                   .When(importHouseNumberPositionFromCrab)
                   .Then(addressId,
                         importHouseNumberPositionFromCrab.ToLegacyEvent()));
        }
        private IEventCentricTestSpecificationBuilder Scenario5(Fixture fixture,
                                                                CrabHouseNumberId crabHouseNumberId,
                                                                WkbGeometry geometry1,
                                                                WkbGeometry geometry2,
                                                                WkbGeometry geometry3)
        {
            var addressId = new AddressId(crabHouseNumberId.CreateDeterministicId());

            var command = new ImportHouseNumberPositionFromCrab(
                new CrabAddressPositionId(4087928),
                crabHouseNumberId,
                geometry3,
                new CrabAddressNature("2"),
                Enum.Parse <CrabAddressPositionOrigin>("2"),
                new CrabLifetime(LocalDateTime.FromDateTime(new DateTime(1830, 1, 1)), null),
                new CrabTimestamp(Instant.FromDateTimeOffset(new DateTimeOffset(2014, 3, 19, 16, 56, 36, 90, TimeSpan.Zero))),
                new CrabOperator("VLM\\CRABSSISservice"),
                CrabModification.Correction,
                Enum.Parse <CrabOrganisation>("1"));

            return(new AutoFixtureScenario(fixture)
                   .Given(Scenario4(fixture, crabHouseNumberId, geometry1, geometry2, geometry3))
                   .When(command)
                   .Then(addressId,
                         command.ToLegacyEvent()));
        }