public void ShouldAssignMapOfBaseTypesToDictionary() { var baseTypeDictionary = new Dictionary <string, int> { { "test", 1 } }; SinTDMap SinTDMap = new SinTDMap(); SinTDMap.keyType = SinTDInstance.GetSinTDType("string"); SinTDMap.elementType = SinTDInstance.GetSinTDType("i32"); Dictionary <string, int> nativeDictionary = (Dictionary <string, int>)SinTDMap.AssignValuesToNativeType(baseTypeDictionary, typeof(Dictionary <string, int>)); Assert.AreEqual(baseTypeDictionary, nativeDictionary); }
public void ShouldAssingMapWithArrayKeysToNativeArrayKeyDictionary() { var arrayKeyDictionary = new Dictionary<int[], string>{ {new int[]{1}, "test"} }; SinTDArray keyArray = new SinTDArray(); keyArray.elementType = SinTDInstance.GetSinTDType("i32"); SinTDMap SinTDMap = new SinTDMap(); SinTDMap.keyType = keyArray; SinTDMap.elementType = SinTDInstance.GetSinTDType("string"); Dictionary<int[], string> nativeDictionary = (Dictionary<int[], string>)SinTDMap .AssignValuesToNativeType(arrayKeyDictionary, arrayKeyDictionary.GetType()); Assert.AreEqual(arrayKeyDictionary.Keys, nativeDictionary.Keys); Assert.AreEqual(arrayKeyDictionary.Values, nativeDictionary.Values); }
public void ShouldAssignMapOfBaseTypesToDictionary() { var baseTypeDictionary = new Dictionary<string, int> { {"test", 1} }; SinTDMap SinTDMap = new SinTDMap(); SinTDMap.keyType = SinTDInstance.GetSinTDType("string"); SinTDMap.elementType = SinTDInstance.GetSinTDType("i32"); Dictionary<string, int> nativeDictionary = (Dictionary<string, int>)SinTDMap.AssignValuesToNativeType(baseTypeDictionary, typeof(Dictionary<string, int>)); Assert.AreEqual(baseTypeDictionary, nativeDictionary); }
public void ShouldAssingMapWithArrayKeysToNativeArrayKeyDictionary() { var arrayKeyDictionary = new Dictionary <int[], string> { { new int[] { 1 }, "test" } }; SinTDArray keyArray = new SinTDArray(); keyArray.elementType = SinTDInstance.GetSinTDType("i32"); SinTDMap SinTDMap = new SinTDMap(); SinTDMap.keyType = keyArray; SinTDMap.elementType = SinTDInstance.GetSinTDType("string"); Dictionary <int[], string> nativeDictionary = (Dictionary <int[], string>)SinTDMap .AssignValuesToNativeType(arrayKeyDictionary, arrayKeyDictionary.GetType()); Assert.AreEqual(arrayKeyDictionary.Keys, nativeDictionary.Keys); Assert.AreEqual(arrayKeyDictionary.Values, nativeDictionary.Values); }