Example #1
0
        public void Should_Check_Contains_Value_True()
        {
            //arrange
            var key   = "key";
            var value = "value";
            var map   = new MyHashTable <string, string>();

            map.Add(key, value);

            //act
            var result = map.ContainsValue(value);

            //assert
            result.ShouldBeEquivalentTo(true);
        }
Example #2
0
        public void Should_Check_SetIndex()
        {
            //arrange
            var key      = "key";
            var value    = "value";
            var newValue = "newValue";

            var map = new MyHashTable <string, string>();

            map.Add(key, value);

            //act
            map[key] = newValue;
            var result = map.ContainsValue(newValue);

            //assert
            result.ShouldBeEquivalentTo(true);
            map.Count.ShouldBeEquivalentTo(1);
        }
Example #3
0
        public void Should_Check_Add_For_SetIndexer()
        {
            //arrange
            var key   = "key";
            var value = "value";

            //act
            var map = new MyHashTable <string, string>();

            map[key] = value;

            var containsKey   = map.ContainsKey(key);
            var containsValue = map.ContainsValue(value);
            var count         = map.Count;

            //assert
            containsKey.ShouldBeEquivalentTo(true);
            containsValue.ShouldBeEquivalentTo(true);
            count.ShouldBeEquivalentTo(1);
        }
Example #4
0
        public void Should_Check_Clear()
        {
            //arrange
            var key   = "key";
            var value = "value";
            var map   = new MyHashTable <string, string>();

            map.Add(key, value);

            //act
            map.Clear();
            var keyResult   = map.ContainsKey(key);
            var valueResult = map.ContainsValue(value);
            var count       = map.Count;

            //assert
            keyResult.ShouldBeEquivalentTo(false);
            valueResult.ShouldBeEquivalentTo(false);
            count.ShouldBeEquivalentTo(0);
        }