Skip to content

Commit

Permalink
test: clear domain events in TestData
Browse files Browse the repository at this point in the history
  • Loading branch information
tnotheis committed Jun 20, 2024
1 parent d145792 commit bb80372
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public static Relationship CreatePendingRelationship(IdentityAddress? from = nul
to ??= IDENTITY_2;
from ??= IDENTITY_1;
var template = new RelationshipTemplate(to, DEVICE_2, 999, null, []);
return new Relationship(template, from, DEVICE_1, [], []);
var relationship = new Relationship(template, from, DEVICE_1, [], []);
relationship.ClearDomainEvents();
return relationship;
}

public static Relationship CreateActiveRelationship(IdentityAddress? from = null, IdentityAddress? to = null)
Expand All @@ -29,34 +31,39 @@ public static Relationship CreateActiveRelationship(IdentityAddress? from = null
var template = new RelationshipTemplate(to, DEVICE_2, 999, null, []);
var relationship = new Relationship(template, from ?? IDENTITY_1, DEVICE_1, [], []);
relationship.Accept(to, DEVICE_2, []);
relationship.ClearDomainEvents();
return relationship;
}

public static Relationship CreateRejectedRelationship()
{
var relationship = new Relationship(RELATIONSHIP_TEMPLATE_OF_2, IDENTITY_1, DEVICE_1, [], []);
relationship.Reject(IDENTITY_2, DEVICE_2, null);
relationship.ClearDomainEvents();
return relationship;
}

public static Relationship CreateRevokedRelationship()
{
var relationship = new Relationship(RELATIONSHIP_TEMPLATE_OF_2, IDENTITY_1, DEVICE_1, [], []);
relationship.Revoke(IDENTITY_1, DEVICE_1, null);
relationship.ClearDomainEvents();
return relationship;
}

public static Relationship CreateTerminatedRelationship(IdentityAddress? from = null, IdentityAddress? to = null)
{
var relationship = CreateActiveRelationship(from, to);
relationship.Terminate(IDENTITY_1, DEVICE_1);
relationship.ClearDomainEvents();
return relationship;
}

public static Relationship CreateRelationshipWithRequestedReactivation(IdentityAddress from, IdentityAddress to, IdentityAddress reactivationRequestedBy)
{
var relationship = CreateTerminatedRelationship(from, to);
relationship.RequestReactivation(reactivationRequestedBy, DEVICE_1);
relationship.ClearDomainEvents();
return relationship;
}

Expand All @@ -68,6 +75,7 @@ public static Relationship CreateDecomposedRelationship(IdentityAddress? from =

var relationship = CreateTerminatedRelationship(from, to);
relationship.Decompose(decomposedBy, DEVICE_1);
relationship.ClearDomainEvents();
return relationship;
}

Expand All @@ -77,6 +85,8 @@ public static Relationship CreateRelationshipDecomposedByFrom(IdentityAddress fr

relationship.Decompose(from, DEVICE_1);

relationship.ClearDomainEvents();

return relationship;
}
}

0 comments on commit bb80372

Please sign in to comment.