public void ConfigReifier_SetFieldsOnObject_CastedObject() { var tc = (object)new TestClass(); var doc = Config.LoadDocFromString( @"--- intKey: 99077 " , "ConfigReifierFacts_ReifyString_TestFilename"); ConfigReifier.SetFieldsOnObject(ref tc, doc); Assert.AreEqual(((TestClass)tc).intKey, 99077); }
public void ConfigReifier_SetFieldsOnObject_PlainObject() { var tc = new TestClass(); var doc = Config.LoadDocFromString( @"--- intKey: 99088 " , "ConfigReifierFacts_ReifyString_TestFilename"); ConfigReifier.SetFieldsOnObject(ref tc, doc); Assert.AreEqual(tc.intKey, 99088); }
public void ConfigReifier_SetFieldsOnObject_BoxedStructArgument() { var s = new ChildStruct(); s.childIntKey = 1; s.childFloatKey = 1; var doc = Config.LoadDocFromString( @"--- childIntKey: 34567 " , "ConfigReifierFacts_ReifyString_TestFilename"); object os = (object)s; ConfigReifier.SetFieldsOnObject(ref os, doc); Assert.AreEqual(((ChildStruct)os).childIntKey, 34567); Assert.AreEqual(((ChildStruct)os).childFloatKey, 1); }