コード例 #1
0
        public void Remove_ReturnsTrue_WhenKeyFound()
        {
            var res = _dictionary.Remove("key");

            res.Should().BeTrue();
            _dictionary.AsEnumerable().Should().BeEmpty();
        }
コード例 #2
0
        public void Construct_WithEmptyDictionaryParameter_IsEmpty()
        {
            var dict   = new Dictionary <string, string>();
            var target = new SingleDictionary <string, string>(dict);

            target.AsEnumerable().Should().BeEmpty();
        }
コード例 #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")
     });
 }
コード例 #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();
        }