Skip to content

Commit

Permalink
test: cleanup/simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tnotheis committed Jul 5, 2024
1 parent 5835e62 commit bc893f9
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Backbone.BuildingBlocks.Domain.Errors;
using Backbone.DevelopmentKit.Identity.ValueObjects;
using Backbone.Job.IdentityDeletion.Workers;
using Backbone.Modules.Devices.Application.Identities;
using Backbone.Modules.Devices.Application.Identities.Commands.TriggerRipeDeletionProcesses;
using Backbone.Modules.Relationships.Application.Relationships.Commands.FindRelationshipsOfIdentity;
using Backbone.Modules.Relationships.Domain.Aggregates.Relationships;
Expand All @@ -27,10 +26,7 @@ public async Task Proxies_triggering_the_deletion_processes_to_command_handler()
var mockMediator = A.Fake<IMediator>();
SetupRipeDeletionProcessesCommand(mockMediator);

var dummyDevicesIdentityDeleter = new IdentityDeleter(mockMediator);
var identityDeleters = new List<IIdentityDeleter> { dummyDevicesIdentityDeleter };

var worker = CreateWorker(mediator: mockMediator, identityDeleters);
var worker = CreateWorker(mediator: mockMediator, []);

// Act
await worker.StartProcessing(CancellationToken.None);
Expand All @@ -49,12 +45,9 @@ public async Task Calls_Deleters_For_Each_Identity()
SetupRipeDeletionProcessesCommand(mockMediator, identityAddress1, identityAddress2);

var mockIdentityDeleter = A.Fake<IIdentityDeleter>();
var dummyDevicesIdentityDeleter = new IdentityDeleter(mockMediator);
var dummyIDeletionProcessLogger = A.Fake<IDeletionProcessLogger>();

var identityDeleters = new List<IIdentityDeleter> { mockIdentityDeleter, dummyDevicesIdentityDeleter };

var worker = CreateWorker(mediator: mockMediator, identityDeleters, deletionProcessLogger: dummyIDeletionProcessLogger);
var worker = CreateWorker(mediator: mockMediator, [mockIdentityDeleter], deletionProcessLogger: dummyIDeletionProcessLogger);

A.CallTo(() => mockMediator.Send(A<FindRelationshipsOfIdentityQuery>._, A<CancellationToken>._))
.Returns(new FindRelationshipsOfIdentityResponse(new List<Relationship>()));
Expand All @@ -78,11 +71,9 @@ public async Task Sends_push_notification_for_each_relationship_of_each_identity
SetupRipeDeletionProcessesCommand(mockMediator, identityAddress1, identityAddress2, identityAddress3);
A.CallTo(() => mockMediator.Send(A<FindRelationshipsOfIdentityQuery>._, A<CancellationToken>._)).Returns(new FindRelationshipsOfIdentityResponse(new List<Relationship>()));

var mockPushNotificationSender = A.Dummy<IPushNotificationSender>();
var dummyDevicesIdentityDeleter = new IdentityDeleter(mockMediator);
var identityDeleters = new List<IIdentityDeleter> { dummyDevicesIdentityDeleter };
var mockPushNotificationSender = A.Fake<IPushNotificationSender>();

var worker = CreateWorker(mediator: mockMediator, identityDeleters, pushNotificationSender: mockPushNotificationSender);
var worker = CreateWorker(mediator: mockMediator, [], pushNotificationSender: mockPushNotificationSender);

// Act
await worker.StartProcessing(CancellationToken.None);
Expand Down

0 comments on commit bc893f9

Please sign in to comment.