Esempio n. 1
0
        public void Add_ThrowsException_WhenKeyIsNull()
        {
            _dictionary = new SingleDictionary <string, string>();
            Action Do = () => _dictionary.Add(null, "value2");

            Do.Should().Throw <ArgumentNullException>();
        }
Esempio n. 2
0
        public void Construct_WithEmptyDictionaryParameter_IsEmpty()
        {
            var dict   = new Dictionary <string, string>();
            var target = new SingleDictionary <string, string>(dict);

            target.AsEnumerable().Should().BeEmpty();
        }
Esempio n. 3
0
 public void Add_AddKeyValue_WhenDictionaryIsEmpty()
 {
     _dictionary = new SingleDictionary <string, string>();
     _dictionary.Add(new  KeyValuePair <string, string> ("key2", "value2"));
     _dictionary.AsEnumerable().Should().BeEquivalentTo(new KeyValuePair <string, string>[] {
         new KeyValuePair <string, string>("key2", "value2")
     });
 }
Esempio n. 4
0
        public void Remove_ReturnsFalse_WhenKeyNotFound_WhenEmpty()
        {
            _dictionary = new SingleDictionary <string, string>();
            var res = _dictionary.Remove("Key");

            res.Should().BeFalse();
            _dictionary.AsEnumerable().Should().BeEmpty();
        }
Esempio n. 5
0
        public SingleDictionaryTest()
        {
            var Dictionary = new Dictionary <string, string>()
            {
                { "key", "value" }
            };

            _dictionary = new SingleDictionary <string, string>(Dictionary);
        }
Esempio n. 6
0
        public void Construct_WithOversizedDictionaryParameter_ThrowException()
        {
            var dict = new Dictionary <string, string>()
            {
                { "key2", "value2" },
                { "key1", "value1" }
            };
            SingleDictionary <string, string> target = null;
            Action Do = () => { target = new SingleDictionary <string, string>(dict); };

            Do.Should().Throw <ArgumentOutOfRangeException>();
        }