public void TestNullableInt() { var clazz = new Class_NullableInt { Attr = 1111 }; DataService.UpdateObject(clazz); var clazz2 = new Class_NullableInt { __PrimaryKey = clazz.__PrimaryKey }; DataService.LoadObject(clazz2); Assert.True(clazz.Attr == clazz2.Attr); clazz2.Attr = clazz2.Attr.Value + 1; DataService.UpdateObject(clazz2); clazz2 = new Class_NullableInt { __PrimaryKey = clazz.__PrimaryKey }; DataService.LoadObject(clazz2); Assert.True(clazz.Attr != clazz2.Attr); clazz2.SetStatus(ObjectStatus.Deleted); DataService.UpdateObject(clazz2); clazz2 = new Class_NullableInt { __PrimaryKey = clazz.__PrimaryKey }; try { DataService.LoadObject(clazz2); Assert.True(false, "Object not deleted."); } catch (CantFindDataObjectException) { } }
public void NullableIntSerialization() { // Arrange. STORMNET.DataObject nullInt = new Class_NullableInt() { Attr = null }; STORMNET.DataObject deserializedObject = new Class_NullableInt(); // Act. var serializedObj = ToolXML.DataObject2XMLDocument(ref nullInt); ToolXML.XMLDocument2DataObject(ref deserializedObject, serializedObj); // Assert. Assert.Equal(((Class_NullableInt)nullInt).Attr, ((Class_NullableInt)deserializedObject).Attr); }