Why do null values get a special treatment? Shouldn't they be trated as just values?
[Test]
public void IsDirtyNotSetWhenValuesAreNull()
{
TestEntity entity = new TestManager().GetTestByID(306582);
Assert.IsTrue(!entity.IsNew);
Assert.IsTrue(!entity.IsDirty);
Assert.IsNull(entity.Field1);
entity.Field1 = null;
Assert.IsTrue(!entity.IsDirty); // fails
}
[Test]
public void IsDirtyNotSetWhenValuesAreSame()
{
string someValue = "321";
TestEntity entity = new TestManager().GetTestByID(309989);
Assert.IsTrue(!entity.IsNew);
Assert.IsTrue(!entity.IsDirty);
Assert.AreEqual(entity.Field1, someValue);
entity.Field1 = someValue;
Assert.IsTrue(!entity.IsDirty); // passes
}