public static void AssertEntityWithNullableProperties(EntityWithNullableProperties actual, EntityWithNullableProperties expected) { Assert.IsNotNull(actual); Assert.AreEqual(expected.MyString, actual.MyString); Assert.AreEqual(expected.MyBool, actual.MyBool); Assert.AreEqual(expected.MyDateTime, actual.MyDateTime); Assert.AreEqual(expected.MyDecimal, actual.MyDecimal); Assert.AreEqual(expected.MyDouble, actual.MyDouble); Assert.AreEqual(expected.MyInteger, actual.MyInteger); }
public void NullableProperties_AreCorrectlySerialized() { // Arrange var entity1 = new EntityWithNormalProperties { Date = new DateTime(2020, 04, 22, 10, 30, 30), Decimal = 314159.26m }; var entity2 = new EntityWithNullableProperties() { Date = new DateTime(2020, 04, 22, 10, 30, 30), Decimal = 314159.26m }; // Act var json1 = Serialize(entity1); var json2 = Serialize(entity2); // Assert Assert.AreEqual(json1, json2); }