Example #1
0
        public void WhenPositionQualityIsLower(
            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.DerivedFromParcelCadastre)
                                               .WithLifetime(crabLifetime);

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImported)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }
Example #2
0
        public void When2PositionsAreCurrentAndLowestGetsHistorized(
            Fixture fixture,
            AddressId addressId,
            CrabLifetime crabLifetime,
            AddressWasRegistered addressWasRegistered,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedHigh,
            AddressSubaddressPositionWasImportedFromCrab addressSubaddressPositionWasImportedLow,
            ImportSubaddressPositionFromCrab importSubaddressPositionFromCrab)
        {
            var addressWasPositioned = new AddressWasPositioned(addressId,
                                                                new AddressGeometry(GeometryMethod.DerivedFromObject, GeometrySpecification.Parcel, new ExtendedWkbGeometry(addressSubaddressPositionWasImportedHigh.AddressPosition)));

            ((ISetProvenance)addressWasPositioned).SetProvenance(fixture.Create <Provenance>());
            var addressWasPositioned2 = new AddressWasPositioned(addressId,
                                                                 new AddressGeometry(GeometryMethod.AppointedByAdministrator, GeometrySpecification.Lot,
                                                                                     new ExtendedWkbGeometry(addressSubaddressPositionWasImportedHigh.AddressPosition)));

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

            addressSubaddressPositionWasImportedLow = addressSubaddressPositionWasImportedLow
                                                      .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                                      .WithBeginDate(crabLifetime.BeginDateTime);

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

            importSubaddressPositionFromCrab = importSubaddressPositionFromCrab
                                               .WithPositionId(new CrabAddressPositionId(addressSubaddressPositionWasImportedLow.AddressPositionId))
                                               .WithCrabAddressPositionOrigin(CrabAddressPositionOrigin.DerivedFromParcelCadastre)
                                               .WithLifetime(new CrabLifetime(crabLifetime.BeginDateTime, LocalDateTime.FromDateTime(DateTime.Now)));

            Assert(new Scenario()
                   .Given(addressId,
                          addressWasRegistered,
                          addressWasPositioned,
                          addressSubaddressPositionWasImportedLow,
                          addressWasPositioned2,
                          addressSubaddressPositionWasImportedHigh)
                   .When(importSubaddressPositionFromCrab)
                   .Then(addressId,
                         importSubaddressPositionFromCrab.ToLegacyEvent()));
        }