public void ConfigReifier_SetFieldsOnStruct_TemplatedStructCall() { var s = new ChildStruct(); s.childIntKey = 1; s.childFloatKey = 1; var doc = Config.LoadDocFromString( @"--- childIntKey: 12345 " , "ConfigReifierFacts_ReifyString_TestFilename"); ConfigReifier.SetFieldsOnStruct(ref s, doc); Assert.AreEqual(s.childIntKey, 12345); Assert.AreEqual(s.childFloatKey, 1); }
public void SetFieldsOnStructForATemplatedStructCall() { var s = new ChildStruct(); s.childIntKey = 1; s.childFloatKey = 1; var doc = Configs.ParseString( @"--- childIntKey: 12345 " , "TestFilename"); reifier.SetFieldsOnStruct(ref s, doc); Assert.AreEqual(s.childIntKey, 12345); Assert.AreEqual(s.childFloatKey, 1); }
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); }
public void SetFieldsOnObjectForABoxedStructArgument() { var s = new ChildStruct(); s.childIntKey = 1; s.childFloatKey = 1; var doc = Configs.ParseString( @"--- childIntKey: 34567 " , "TestFilename"); object os = s; reifier.SetFieldsOnObject(ref os, doc); Assert.AreEqual(((ChildStruct)os).childIntKey, 34567); Assert.AreEqual(((ChildStruct)os).childFloatKey, 1); }