public void BasicWriteTest_FieldsOnStruct() { var now = DateTime.Now; object obj = new FieldsOnStruct(); var access = TypeAccessor.Create(typeof(FieldsOnStruct)); access[obj, "A"] = 123; Assert.Equal(123, ((FieldsOnStruct)obj).A); }
public void BasicReadTest_FieldsOnStruct() { var now = DateTime.Now; var obj = new FieldsOnStruct() { A = 123, B = "abc", C = now, D = null }; var access = TypeAccessor.Create(typeof(FieldsOnStruct)); Assert.AreEqual(123, access[obj, "A"]); Assert.AreEqual("abc", access[obj, "B"]); Assert.AreEqual(now, access[obj, "C"]); Assert.AreEqual(null, access[obj, "D"]); }
public void BasicReadTest_FieldsOnStruct() { var now = DateTime.Now; var obj = new FieldsOnStruct { A = 123, B = "abc", C = now, D = null }; var access = TypeAccessor.Create(typeof(FieldsOnStruct)); Assert.AreEqual(123, access[obj, "A"]); Assert.AreEqual("abc", access[obj, "B"]); Assert.AreEqual(now, access[obj, "C"]); Assert.AreEqual(null, access[obj, "D"]); }
public void BasicWriteTest_FieldsOnStruct() { var now = DateTime.Now; object obj = new FieldsOnStruct(); var access = TypeAccessor.Create(typeof(FieldsOnStruct)); access[obj, "A"] = 123; Assert.AreEqual(123, ((FieldsOnStruct)obj).A); }