public void GivenAddressPositionHasEndDate(
            IFixture fixture,
            AddressId addressId,
            AddressHouseNumberPositionWasImportedFromCrab addressHouseNumberPositionWasImported,
            ImportHouseNumberFromCrab importHouseNumberFromCrab)
        {
            addressHouseNumberPositionWasImported = addressHouseNumberPositionWasImported
                                                    .WithEndDate(DateTimeOffset.Now)
                                                    .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.ManualIndicationFromEntryOfBuilding);

            importHouseNumberFromCrab = importHouseNumberFromCrab
                                        .WithLifetime(new CrabLifetime(LocalDateTime.FromDateTime(DateTime.Now), LocalDateTime.FromDateTime(DateTime.Now.AddDays(1))));

            Assert(RegisteredAddressScenario(fixture)
                   .Given(addressId, addressHouseNumberPositionWasImported)
                   .When(importHouseNumberFromCrab)
                   .Then(addressId,
                         new AddressWasRetired(addressId),
                         new AddressWasPositioned(addressId, new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Entry, GeometryHelpers.CreateEwkbFrom(new WkbGeometry(addressHouseNumberPositionWasImported.AddressPosition)))),
                         importHouseNumberFromCrab.ToLegacyEvent()));
        }
Exemplo n.º 2
0
 public static AddressHouseNumberPositionWasImportedFromCrab WithEndDate(this AddressHouseNumberPositionWasImportedFromCrab @event, DateTimeOffset?endDate)
 {
     return(@event.WithEndDate(endDate.HasValue ? LocalDateTime.FromDateTime(endDate.Value.LocalDateTime) : new LocalDateTime?()));
 }