Skip to content

Commit

Permalink
fix: mainbuildingtype realizeunplannedbuildingunit
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Mar 27, 2024
1 parent 2783f12 commit 836e789
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace BuildingRegistry.Api.BackOffice.Handlers.Lambda.Handlers.Building

public sealed class RealizeAndMeasureUnplannedBuildingLambdaHandler : BuildingLambdaHandler<RealizeAndMeasureUnplannedBuildingLambdaRequest>
{
private const string MainBuildingGrbObjectType = "1";
private const string MainBuildingGrbObjectType = "MainBuilding";

private readonly IParcelMatching _parcelMatching;
private readonly IAddresses _addresses;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace BuildingRegistry.Tests.BackOffice.Lambda.Building
using Fixtures;
using FluentAssertions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using Moq;
using NodaTime;
using SqlStreamStore;
Expand All @@ -33,6 +34,8 @@ namespace BuildingRegistry.Tests.BackOffice.Lambda.Building

public partial class WhenRealizingAndMeasuringUnplannedBuilding : BackOfficeLambdaTest
{
private const string MainBuildingObjectType = "MainBuilding";

private readonly IdempotencyContext _idempotencyContext;
private readonly BackOfficeContext _backOfficeContext;
private readonly Mock<IPersistentLocalIdGenerator> _persistentLocalIdGenerator;
Expand Down Expand Up @@ -63,7 +66,8 @@ public async Task ThenBuildingIsRealizedAndMeasured()
Mock.Of<IAddresses>(),
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
await handler.Handle(
Expand Down Expand Up @@ -119,7 +123,8 @@ public async Task WhenIdempotencyException_ThenTicketingCompleteIsExpected()
Mock.Of<IAddresses>(),
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
await handler.Handle(
Expand Down Expand Up @@ -172,7 +177,8 @@ public async Task GivenRetryingRequest_ThenBuildingIsRealizedAndMeasured()
Mock.Of<IAddresses>(),
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

var request = new RealizeAndMeasureUnplannedBuildingLambdaRequest(
buildingPersistentLocalId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace BuildingRegistry.Tests.BackOffice.Lambda.Building
using BuildingRegistry.Building.Events;
using FluentAssertions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using Moq;
using NetTopologySuite.Geometries;
using NodaTime;
Expand Down Expand Up @@ -77,7 +78,8 @@ public async Task MainBuildingWithRemovedAddress_ThenNotRealizeUnplannedBuilding
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -95,7 +97,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -159,7 +161,8 @@ public async Task MainBuildingWithNotActiveAddresses_ThenNotRealizeUnplannedBuil
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -177,7 +180,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -246,7 +249,8 @@ await _backOfficeContext.AddIdempotentBuildingUnitAddressRelation(
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -264,7 +268,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -337,7 +341,8 @@ public async Task MainBuildingWithTwoUnderlyingParcelAddress_ThenNotRealizeUnpla
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -355,7 +360,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -417,7 +422,8 @@ public async Task MainBuildingWithNoUnderlyingParcelAddress_ThenNotRealizeUnplan
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -435,7 +441,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -496,7 +502,8 @@ public async Task MainBuildingWithOneUnderlyingParcelAddress_ThenRealizeUnplanne
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -514,7 +521,7 @@ await handler.Handle(
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -573,7 +580,8 @@ public async Task ThenRealizeUnplannedBuildingUnitIsIdempotent()
addresses.Object,
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand All @@ -592,7 +600,7 @@ public async Task ThenRealizeUnplannedBuildingUnitIsIdempotent()
{
GrbData = new GrbData
{
GrbObjectType = "1",
GrbObjectType = MainBuildingObjectType,
VersionDate = SystemClock.Instance.GetCurrentInstant().ToString(),
GeometriePolygoon =
"<gml:Polygon srsName=\"https://www.opengis.net/def/crs/EPSG/0/31370\" xmlns:gml=\"http://www.opengis.net/gml/3.2\"><gml:exterior><gml:LinearRing><gml:posList>140284.15277253836 186724.74131567031 140291.06016454101 186726.38355567306 140288.22675654292 186738.25798767805 140281.19098053873 186736.57913967967 140284.15277253836 186724.74131567031</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
Expand Down Expand Up @@ -654,7 +662,8 @@ public async Task NotMainBuilding_ThenNoRealizeUnplannedBuildingUnitCommand(stri
Mock.Of<IAddresses>(),
_backOfficeContext,
_persistentLocalIdGenerator.Object,
Container);
Container,
NullLoggerFactory.Instance);

//Act
var buildingPersistentLocalId = Fixture.Create<BuildingPersistentLocalId>();
Expand Down

0 comments on commit 836e789

Please sign in to comment.