I have following test method:
[Test]
public void GetUserTest()
{
//Arrange
User user = new User();
user.Name = "someName";
user.BirthDate = DateTime.Now;
_dataContext.Users.Add(user);
_dataContext.SaveChanges();
//Execute
user = _dbService.GetUser(???);
//Assert
Assert.NotNull(user);
}
ID is auto generated for User object, so how should I get this particular one? Behind GetUser() im using a Find(id) method from DbSet class.
Aucun commentaire:
Enregistrer un commentaire