Refactor user creation and retrieval in tests

Updated `DbRepositoryTests` to await `CreateAsync` directly for user creation. Changed assertion to compare the created user with the user retrieved from the repository, enhancing test accuracy.
This commit is contained in:
Developer 02
2025-04-17 16:43:15 +02:00
parent 476c86ff0a
commit 3a604ede88

View File

@@ -60,10 +60,10 @@ public class DbRepositoryTests
var user = faker.Generate();
// Act
await _userRepo.CreateAsync(user);
var createdUser = (await _userRepo.ReadAsync()).First();
var createdUser = await _userRepo.CreateAsync(user);
var readUser = await _userRepo.ReadFirstOrDefaultAsync(u => u.Id == createdUser.Id);
// Assert
Assert.That(createdUser, Is.EqualTo(user));
Assert.That(createdUser, Is.EqualTo(readUser));
}
}