public void ShouldAssignStructWithArrayByName() { var aStructInstance = new arrayStruct { arr = new int[] { 1 } }; Dictionary <string, object> inst = aStruct.AssignValuesFromObject(aStructInstance) as Dictionary <string, object>; object[] arrayInst = inst["arr"] as object[]; Assert.AreEqual(1, arrayInst.Length); Assert.AreEqual(1, arrayInst[0]); }
public void ShouldAssignStructWithMapByName() { var mStructInstance = new mapStruct { map = new Dictionary <string, bool> { { "value", true } } }; Dictionary <string, object> inst = mStruct.AssignValuesFromObject(mStructInstance) as Dictionary <string, object>; Dictionary <object, object> m = inst["map"] as Dictionary <object, object>; Assert.AreEqual("value", m.Keys.ElementAt(0)); Assert.AreEqual(true, m.Values.ElementAt(0)); }
public void ShouldAssignStructOfBaseTypesByName() { var structInstance = new testStruct { x = 1, y = 2 }; Dictionary <string, object> inst = intStruct.AssignValuesFromObject(structInstance) as Dictionary <string, object>; Assert.AreEqual(1, inst["x"]); Assert.AreEqual(2, inst["y"]); }
public void ShouldAssignStructWithStructFromStructByName() { var structStructInstance = new structStruct { child = new testStruct { x = 1, y = 2, } }; Dictionary <string, object> inst = sStruct.AssignValuesFromObject(structStructInstance) as Dictionary <string, object>; Dictionary <string, object> childInst = inst["child"] as Dictionary <string, object>; Assert.AreEqual(1, childInst["x"]); Assert.AreEqual(2, childInst["y"]); }