Skip to content

Commit

Permalink
feat: Add deleted entities to integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alex289 committed Dec 8, 2024
1 parent 8b9253c commit a03f1ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public async Task SeedTestData()
CreatedTenantId,
"Test Tenant"));

// This tenant should not be included in any queries
var deletedTenant = new Tenant(
CreatedTenantId,
"Test Tenant2");
deletedTenant.Delete();
context.Tenants.Add(deletedTenant);

context.Users.Add(new User(
Guid.NewGuid(),
CreatedTenantId,
Expand Down
15 changes: 14 additions & 1 deletion CleanArchitecture.IntegrationTests/Fixtures/UserTestFixture.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using CleanArchitecture.Domain.Constants;
using CleanArchitecture.Domain.Entities;
using CleanArchitecture.Domain.Enums;
Expand Down Expand Up @@ -29,6 +30,18 @@ public async Task SeedTestData()
"$2a$12$Blal/uiFIJdYsCLTMUik/egLbfg3XhbnxBC6Sb5IKz2ZYhiU/MzL2",
UserRole.Admin));

// This user should not be included in any queries
var deletedUsed = new User(
Guid.NewGuid(),
Ids.Seed.TenantId,
"admin2@email.com",
"Admin2",
"User2",
"$2a$12$Blal/uiFIJdYsCLTMUik/egLbfg3XhbnxBC6Sb5IKz2ZYhiU/MzL2",
UserRole.User);
deletedUsed.Delete();
context.Users.Add(deletedUsed);

context.Users.Add(new User(
TestAuthenticationOptions.TestUserId,
Ids.Seed.TenantId,
Expand Down

0 comments on commit a03f1ce

Please sign in to comment.