I am writing integration and unit tests and have a static TestData.cs class which provides test data, typically into the Arrange
section of each test, for example...
// Arrange
var hol = TestData.Holiday().Where(h => h.Year == 2020 && h.Description == "Star Wars Day").Single();
var user = TestData.TestUser().UserId();
// Act
var newHol = await Repository.AddHoliday(hol, user);
When I come to assert the property values of the new object, should I do a) or b), or something different?
a)
// Assert
Assert.NotNull(newHol);
Assert.IsType<CalHoliday>(newHol);
Assert.Equal(new DateTime(2020, 05, 04), newHol.HolidayDate);
Assert.Equal(2020, newHol.Year);
Assert.Equal("Star Wars Day", newHol.Description);
Assert.Equal("TestUser", newHol.CreateUserId);
b)
// Assert
Assert.NotNull(newHol);
Assert.IsType<CalHoliday>(newHol);
Assert.Equal(hol.HolidayDate, newHol.HolidayDate);
Assert.Equal(hol.Year, newHol.Year);
Assert.Equal(hol.Description, newHol.Description);
Assert.Equal(user.UserId, newHol.CreateUserId);