Skip to content

Commit

Permalink
test: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emalfroy committed Jan 11, 2024
1 parent b199b55 commit 3b4aa71
Show file tree
Hide file tree
Showing 9 changed files with 3,164 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void Configure(EntityTypeBuilder<AddressLatestItem> builder)
builder.Property(x => x.VersionAsString).HasColumnName("version_as_string");
builder.Property(AddressLatestItem.VersionTimestampBackingPropertyName).HasColumnName("version_timestamp");
builder.Property(x => x.CreatedOnAsString).HasColumnName("created_on_as_string");
builder.Property(AddressVersion.CreatedTimestampBackingPropertyName).HasColumnName("created_on_timestamp");
builder.Property(AddressLatestItem.CreatedTimestampBackingPropertyName).HasColumnName("created_on_timestamp");

builder.Ignore(x => x.VersionTimestamp);
builder.Ignore(x => x.CreatedOnTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Current;
item.OsloStatus = AddressStatus.Current.ToString();
item.OsloStatus = AddressStatus.Current.Map();
},
ct);
});
Expand All @@ -102,7 +102,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Proposed;
item.OsloStatus = AddressStatus.Proposed.ToString();
item.OsloStatus = AddressStatus.Proposed.Map();
},
ct);
});
Expand All @@ -115,7 +115,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Proposed;
item.OsloStatus = AddressStatus.Proposed.ToString();
item.OsloStatus = AddressStatus.Proposed.Map();
},
ct);
});
Expand All @@ -128,7 +128,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Rejected;
item.OsloStatus = AddressStatus.Rejected.ToString();
item.OsloStatus = AddressStatus.Rejected.Map();
},
ct);
});
Expand All @@ -141,7 +141,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Rejected;
item.OsloStatus = AddressStatus.Rejected.ToString();
item.OsloStatus = AddressStatus.Rejected.Map();
},
ct);
});
Expand All @@ -154,7 +154,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Rejected;
item.OsloStatus = AddressStatus.Rejected.ToString();
item.OsloStatus = AddressStatus.Rejected.Map();
},
ct);
});
Expand All @@ -167,7 +167,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Rejected;
item.OsloStatus = AddressStatus.Rejected.ToString();
item.OsloStatus = AddressStatus.Rejected.Map();
},
ct);
});
Expand All @@ -180,7 +180,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Retired;
item.OsloStatus = AddressStatus.Retired.ToString();
item.OsloStatus = AddressStatus.Retired.Map();
},
ct);
});
Expand All @@ -193,7 +193,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Rejected;
item.OsloStatus = AddressStatus.Rejected.ToString();
item.OsloStatus = AddressStatus.Rejected.Map();
},
ct);
});
Expand All @@ -207,7 +207,7 @@ await context.CreateNewAddressVersion(
{
item.OfficiallyAssigned = false;
item.Status = AddressStatus.Current;
item.OsloStatus = AddressStatus.Current.ToString();
item.OsloStatus = AddressStatus.Current.Map();
},
ct);
});
Expand All @@ -229,7 +229,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Retired;
item.OsloStatus = AddressStatus.Retired.ToString();
item.OsloStatus = AddressStatus.Retired.Map();
},
ct);
});
Expand All @@ -242,7 +242,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Retired;
item.OsloStatus = AddressStatus.Retired.ToString();
item.OsloStatus = AddressStatus.Retired.Map();
},
ct);
});
Expand All @@ -255,7 +255,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Retired;
item.OsloStatus = AddressStatus.Retired.ToString();
item.OsloStatus = AddressStatus.Retired.Map();
},
ct);
});
Expand All @@ -268,7 +268,7 @@ await context.CreateNewAddressVersion(
item =>
{
item.Status = AddressStatus.Current;
item.OsloStatus = AddressStatus.Current.ToString();
item.OsloStatus = AddressStatus.Current.Map();
},
ct);
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/AddressRegistry.Tests/AddressRegistry.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ProjectReference Include="..\..\src\AddressRegistry.Consumer.Read.StreetName\AddressRegistry.Consumer.Read.StreetName.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry.Consumer\AddressRegistry.Consumer.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry.Projections.BackOffice\AddressRegistry.Projections.BackOffice.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry.Projections.Integration\AddressRegistry.Projections.Integration.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry.Projections.Wfs\AddressRegistry.Projections.Wfs.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry.Projections.Wms\AddressRegistry.Projections.Wms.csproj" />
<ProjectReference Include="..\..\src\AddressRegistry\AddressRegistry.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ public static AddressWasProposedV2 WithAddressPersistentLocalId(
return newEvent;
}

public static AddressWasProposedV2 WithAddressPersistentLocalId(
this AddressWasProposedV2 @event,
int addressPersistentLocalId)
{
var newEvent = new AddressWasProposedV2(
new StreetNamePersistentLocalId(@event.StreetNamePersistentLocalId),
new AddressPersistentLocalId(addressPersistentLocalId),
@event.ParentPersistentLocalId is not null ? new AddressPersistentLocalId(@event.ParentPersistentLocalId.Value) : null,
new PostalCode(@event.PostalCode),
new HouseNumber(@event.HouseNumber),
@event.BoxNumber is not null ? new BoxNumber(@event.BoxNumber) : null,
@event.GeometryMethod,
@event.GeometrySpecification,
new ExtendedWkbGeometry(@event.ExtendedWkbGeometry));
((ISetProvenance)newEvent).SetProvenance(@event.Provenance.ToProvenance());

return newEvent;
}

public static AddressWasProposedV2 WithParentAddressPersistentLocalId(
this AddressWasProposedV2 @event,
AddressPersistentLocalId? parentAddressPersistentLocalId)
Expand Down
Loading

0 comments on commit 3b4aa71

Please sign in to comment.