コード例 #1
0
        public void Should_generate_a_hash_when_information_added()
        {
            DictionaryGeneric dico = new DictionaryGeneric();
            int hash = dico.GetHashFrom("Hello");

            Check.That(hash).IsEqualTo(5);
        }
コード例 #2
0
        public void Should_throw_an_exception_when_key_already_exist()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            Check.ThatCode(() => { dico.Add("Hello", "titi"); }).Throws <Exception>();
        }
コード例 #3
0
        public void Should_return_an_null_when_key_not_existing_getted()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            var value = dico.Get("KEY");

            Check.That(value).IsNull();
        }
コード例 #4
0
        public void Should_add_and_return_an_element_when_you_called()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            string titiValue = dico.Get("Hello");

            Check.That(titiValue).IsEqualTo("titi");
        }
コード例 #5
0
        public void Should_return_size_when_selected()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            dico.Add("HILLA", "titi");
            var size = dico.Size();

            Check.That(size).IsEqualTo(2);
        }
コード例 #6
0
        public void Should_update_an_element_when_selected()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            dico.Update("Hello", "lala");
            var value = dico.Get("Hello");

            Check.That(value).IsEqualTo("lala");
        }
コード例 #7
0
        public void Should_remove_an_element_when_selected()
        {
            DictionaryGeneric dico = new DictionaryGeneric();

            dico.Add("Hello", "titi");
            dico.Remove("Hello");
            var value = dico.Get("Hello");

            Check.That(value).IsNull();
        }