Hi Guys,
Came across the following MS Unit Test:
[TestMethod]
public void PersonRepository_AddressCountForSinglePerson_IsNotEqualToZero()
{
// Arrange.
Person person;
// Act.
person = personRepository.FindSingle(1);
// Assert.
Assert.AreNotEqual<int>(person.Addresses.Count, 0);
}
I have never seen the use of generics when doing Assertions.
This is how i would write the Assertion:
// Assert.
Assert.AreNotEqual(person.Addresses.Count, 0);
What is the difference?
When i hover over the AreNotEqual overload i am using, the method is using the overload which compares two doubles (not sure why there isn't an int, int overload).
And if i do put the generic type-parameter of <int>
in, Resharper says it's redundant.
So my question is - if the way i do it is still type-safe, why use generic assertions?