Ejemplo n.º 1
0
        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]);
        }
Ejemplo n.º 2
0
        public void ShouldAssignArrayStructInstanceToNativeArrayStruct()
        {
            var aStructInstance = new arrayStruct
            {
                arr = new int[] { 1 }
            };

            Dictionary <string, object> inst
                = aStruct.AssignValuesFromObject(aStructInstance) as Dictionary <string, object>;
            arrayStruct nativeStruct = (arrayStruct)aStruct.AssignValuesToNativeType(inst, typeof(arrayStruct));

            Assert.AreEqual(1, nativeStruct.arr.Length);
            Assert.AreEqual(1, nativeStruct.arr[0]);
        }
Ejemplo n.º 3
0
        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]);
        }
Ejemplo n.º 4
0
        public void ShouldAssignArrayStructInstanceToNativeArrayStruct()
        {
            var aStructInstance = new arrayStruct
            {
                arr = new int[] { 1 }
            };

            Dictionary<string, object> inst
                = aStruct.AssignValuesFromObject(aStructInstance) as Dictionary<string, object>;
            arrayStruct nativeStruct = (arrayStruct)aStruct.AssignValuesToNativeType(inst, typeof(arrayStruct));
            Assert.AreEqual(1, nativeStruct.arr.Length);
            Assert.AreEqual(1, nativeStruct.arr[0]);
        }