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:
@@ -60,10 +60,10 @@ public class DbRepositoryTests
|
|||||||
var user = faker.Generate();
|
var user = faker.Generate();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await _userRepo.CreateAsync(user);
|
var createdUser = await _userRepo.CreateAsync(user);
|
||||||
var createdUser = (await _userRepo.ReadAsync()).First();
|
var readUser = await _userRepo.ReadFirstOrDefaultAsync(u => u.Id == createdUser.Id);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(createdUser, Is.EqualTo(user));
|
Assert.That(createdUser, Is.EqualTo(readUser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user