Skip to content

Commit

Permalink
base constructor for static analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
drr00t committed Feb 5, 2023
1 parent 7947050 commit f091cbc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/DFlow/Aggregates/AggregateBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace DFlow.Aggregates
public abstract class AggregateBase<TChange, TEntityId>:BaseValidation,
IAggregate<TChange> where TChange: EntityBase<TEntityId>
{
protected AggregateBase(TChange root)
{
Root = root;
}

protected TChange Root { get; private set; }

protected void Apply(TChange item)
Expand Down
2 changes: 1 addition & 1 deletion src/DFlow/BusinessObjects/EntityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override string ToString()

protected abstract IEnumerable<object> GetEqualityComponents();

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (obj == null)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/DFlow.Testing/Domain/PrimaryEntityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public void SecondaryEntity_Updated(PrimaryEntity primary, SecondaryEntity toUpd
{
primary.UpdateSecondary(toUpdate);
var raisedEvent = primary.GetEvents()[0] as SecondaryEntityUpdatedEvent;
Assert.Equal(expected.Identity.Value, raisedEvent.SecondaryEntityId);
Assert.Equal(expected.Identity.Value, raisedEvent?.SecondaryEntityId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace DFlow.Testing.Supporting.DomainObjects.Aggregates;

public sealed class PrimaryEntityAggregate : AggregateBase<PrimaryEntity, PrimaryEntityId>
{
public PrimaryEntityAggregate(PrimaryEntity primaryEntity)
private PrimaryEntityAggregate(PrimaryEntity primaryEntity)
:base(primaryEntity)
{
if (primaryEntity.IsValid)
{
Expand Down

0 comments on commit f091cbc

Please sign in to comment.