Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace AddAsync calls with Add calls #201

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions LeaderboardBackend.Test/Features/Users/ConfirmAccountTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task ConfirmAccount_BadConfirmationId()
}
};

await context.AccountConfirmations.AddAsync(confirmation);
context.AccountConfirmations.Add(confirmation);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.PutAsync(Routes.ConfirmAccount(Guid.NewGuid()), null);
res.StatusCode.Should().Be(HttpStatusCode.NotFound);
Expand Down Expand Up @@ -94,7 +94,7 @@ public async Task ConfirmAccount_BadRole()
}
};

await context.AccountConfirmations.AddAsync(confirmation);
context.AccountConfirmations.Add(confirmation);
await context.SaveChangesAsync();

HttpResponseMessage res = await _client.PutAsync(Routes.ConfirmAccount(confirmation.Id), null);
Expand Down Expand Up @@ -122,7 +122,7 @@ public async Task ConfirmAccount_Expired()
}
};

await context.AccountConfirmations.AddAsync(confirmation);
context.AccountConfirmations.Add(confirmation);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.PutAsync(Routes.ConfirmAccount(confirmation.Id), null);
res.StatusCode.Should().Be(HttpStatusCode.NotFound);
Expand Down Expand Up @@ -151,7 +151,7 @@ public async Task ConfirmAccount_AlreadyUsed()
}
};

await context.AccountConfirmations.AddAsync(confirmation);
context.AccountConfirmations.Add(confirmation);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.PutAsync(Routes.ConfirmAccount(confirmation.Id), null);
res.StatusCode.Should().Be(HttpStatusCode.NotFound);
Expand All @@ -178,7 +178,7 @@ public async Task ConfirmAccount_Success()
};

ApplicationContext context = _scope.ServiceProvider.GetRequiredService<ApplicationContext>();
await context.AccountConfirmations.AddAsync(confirmation);
context.AccountConfirmations.Add(confirmation);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.PutAsync(Routes.ConfirmAccount(confirmation.Id), null);
res.Should().HaveStatusCode(HttpStatusCode.OK);
Expand Down
8 changes: 4 additions & 4 deletions LeaderboardBackend.Test/Features/Users/SendRecoveryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task SendRecoveryEmail_MalformedMissingUsername()
Role = UserRole.Confirmed
};

await context.Users.AddAsync(user);
context.Users.Add(user);
await context.SaveChangesAsync();

HttpResponseMessage res = await Client.PostAsJsonAsync(
Expand Down Expand Up @@ -103,7 +103,7 @@ public async Task SendRecoveryEmail_MalformedMissingEmail()
Role = UserRole.Confirmed
};

await context.Users.AddAsync(user);
context.Users.Add(user);
await context.SaveChangesAsync();

HttpResponseMessage res = await Client.PostAsJsonAsync(
Expand Down Expand Up @@ -152,7 +152,7 @@ public async Task SendRecoveryEmail_BadRole(UserRole role)
Role = role
};

await context.Users.AddAsync(user);
context.Users.Add(user);
await context.SaveChangesAsync();

HttpResponseMessage res = await Client.PostAsJsonAsync(
Expand Down Expand Up @@ -232,7 +232,7 @@ public async Task SendRecoveryEmail_Success()
Role = UserRole.Confirmed
};

await context.Users.AddAsync(user);
context.Users.Add(user);
await context.SaveChangesAsync();

HttpResponseMessage res = await client.PostAsJsonAsync(
Expand Down
8 changes: 4 additions & 4 deletions LeaderboardBackend.Test/Features/Users/TestRecoveryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public async Task TestRecovery_Expired()
}
};

await context.AccountRecoveries.AddAsync(recovery);
context.AccountRecoveries.Add(recovery);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.GetAsync(Routes.RecoverAccount(recovery.Id));
res.StatusCode.Should().Be(HttpStatusCode.NotFound);
Expand All @@ -83,7 +83,7 @@ public async Task TestRecovery_Old()
Username = "username",
Role = UserRole.Confirmed
};
await context.Users.AddAsync(user);
context.Users.Add(user);

AccountRecovery recovery1 = new()
{
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task TestRecovery_Used()
}
};

await context.AccountRecoveries.AddAsync(recovery);
context.AccountRecoveries.Add(recovery);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.GetAsync(Routes.RecoverAccount(recovery.Id));
res.Should().HaveStatusCode(HttpStatusCode.NotFound);
Expand Down Expand Up @@ -153,7 +153,7 @@ public async Task TestRecovery_Roles(UserRole role, HttpStatusCode expected)
}
};

await context.AccountRecoveries.AddAsync(recovery);
context.AccountRecoveries.Add(recovery);
await context.SaveChangesAsync();
HttpResponseMessage res = await _client.GetAsync(Routes.RecoverAccount(recovery.Id));
res.Should().HaveStatusCode(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<CreateRecoveryResult> CreateRecoveryAndSendEmail(User user)
User = user
};

await _applicationContext.AccountRecoveries.AddAsync(recovery);
_applicationContext.AccountRecoveries.Add(recovery);
await _applicationContext.SaveChangesAsync();

try
Expand Down
Loading