vs null
Hi I have a test where: Assert.AreEqual(null, object.attribute)
In the test the attribute is not initiated/created/given a value and is <>
says that expected null actual <> how do I make expected <> as in empty?
2 Replies
Wdym "not initiated/created/given a value"?
What type is it? Values in C# cannot be "undefined", it's either a value or null.
I would agree that this question is insufficient. You can step through your test (place a breakpoint and debug the test) to look at the objects more closely, but unless the
object.attribute
property was initialized or is a value type, it should be null. Keep in mind that if it's not your own code that's creating it, it may well be initialized in the default constructor.