why is the line:
Assert.IsFalse(myInt.HasValue);
possible? I would expect a NullPointerException
as myInt
is null
.
[TestMethod]
public void Test_NullableInt_ShortDeclaration_WithValueAssignment()
{
int? myInt = null;
Assert.IsNull(myInt);
Assert.IsFalse(myInt.HasValue); // Why is this possible?
myInt = 5;
Assert.IsNotNull(myInt);
Assert.IsTrue(myInt.HasValue);
}
Regards