public void DictionarySupportKnowsTheLengthOfAnyDictionary() { var dictionary = new Dictionary<string, int>(); for (var i = 0; i < 30; i++) dictionary.Add(i.ToString(), i); var dictionarySupport = new DictionarySupport(); Assert.AreEqual(dictionary.Count, dictionarySupport.GetLength(dictionary)); }
public void DictionarySupportShouldGetAndSetItems() { var dictionary = new Dictionary<string, int>(); var test = new Dictionary<string, int>(); for (var i = 0; i < 30; i++) dictionary.Add(i.ToString(), i); var dictionarySupport = new DictionarySupport(); var items = dictionarySupport.GetItems(dictionary); dictionarySupport.SetItems(test, items); var matches = true; var dictionaryList = dictionary.ToSimpleList(); var testList = test.ToSimpleList(); for (var i = 0; i < dictionaryList.Count; i++) { var dictionaryItem = dictionaryList[i]; var testItem = testList[i]; if (!dictionaryItem.Key.Equals(testItem.Key)) { matches = false; break; } if (!dictionaryItem.Value.Equals(testItem.Value)) { matches = false; break; } } Assert.IsTrue(matches); }
public void DictionarySupportKnowsTheEnumerableMarkOfItself() { var dictionarySupport = new DictionarySupport(); Assert.AreEqual(ComplexTypeMark.Dictionary, dictionarySupport.ComplexTypeMark); }