Example #1
0
        public void TestContainsKey()
        {
            DictionaryClass<string, int> d = new DictionaryClass<string, int>(2);
            d.Add("cats", 1);
            d.Add("birds", 14);
            d.Add("cows", 5);

            Assert.AreEqual(true, d.ContainsKey("cats"));
            Assert.AreEqual(false, d.ContainsKey("sheeps"));
        }
 public void FindAWordInDictionaryWithTwoWordsWithSameHash()
 {
     var dictionary = new DictionaryClass<string, string>();
     dictionary.Add("apple", "apple");
     dictionary.Add("apple", "pear");
     dictionary.ContainsKey("apple").ShouldBeTrue();
 }
 public void FindAWordInEmptyDictionary()
 {
     var newEntry = new NewEntry("apple", "It is a fruit");
     var dictionary = new DictionaryClass<string, NewEntry>();
     dictionary.ContainsKey(newEntry.Name).ShouldBeFalse();
 }
 public void FindAWordInDictionaryWithOneWord()
 {
     var dictionary = new DictionaryClass<string, string>();
     dictionary.Add("apple", "apple");
     dictionary.ContainsKey("apple").ShouldBeTrue();
 }