public void TestConvertingDictionaryToEntry1WhereOneElementIsSet() { Dictionary <Object, Object> test = new Dictionary <Object, Object>(); test.Add("1", 11); test.Add("21", 111); Entry1[] result = ExtendMethods.ConvertMap <Entry1>(test); foreach (Entry1 e1 in result) { Assert.IsTrue(test.ContainsKey(e1.key)); Assert.AreEqual(test[e1.key], e1.value); } }
public void TestConvertingDictionaryToMap() { // Map = EntryX[] Dictionary <Object, Object> test = new Dictionary <Object, Object>(); test.Add("1", 11); test.Add("21", 111); Entry1[] result = (Entry1[])ExtendMethods.ConvertMap(test, typeof(Entry1)); foreach (Entry1 e1 in result) { Assert.IsTrue(test.ContainsKey(e1.key)); Assert.AreEqual(test[e1.key], e1.value); } }
public void TestConvertingMapToDictionary() { // Map = EntryX[] Entry1[] test = new Entry1[] { new Entry1() { key = "1", value = 11 }, new Entry1() { key = "21", value = 21 } }; IDictionary <String, int> result = ExtendMethods.ConvertMap <String, int>(test); foreach (Entry1 e1 in test) { Assert.IsTrue(result.ContainsKey(e1.key)); Assert.AreEqual(result[e1.key], e1.value); } }