Exemplo n.º 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);
        }
Exemplo n.º 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>();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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");
        }
Exemplo n.º 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);
        }
Exemplo n.º 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");
        }
Exemplo n.º 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();
        }