I’ve seen people write unit tests for things that should simply be taken for granted. E.g.:
class Employee
{
public int Id { get; set; }
public string Name { get; set; }
//.....
}
Unit test:
Assert.AreEqual(new Employee().Id, 0);
Seems like a massive waste of time and resources, yet some people do write tests like this. I’ve even seen it in some samples from Microsoft.
Am I missing something?
they should be targeted at behaviour, so this test that the default is 0 is pretty pointless unless there is a reason you need it to behave that way, for example a stack starting empty.