public void Add_ThrowsException_WhenKeyIsNull() { _dictionary = new SingleDictionary <string, string>(); Action Do = () => _dictionary.Add(null, "value2"); Do.Should().Throw <ArgumentNullException>(); }
public void Construct_WithEmptyDictionaryParameter_IsEmpty() { var dict = new Dictionary <string, string>(); var target = new SingleDictionary <string, string>(dict); target.AsEnumerable().Should().BeEmpty(); }
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") }); }
public void Remove_ReturnsFalse_WhenKeyNotFound_WhenEmpty() { _dictionary = new SingleDictionary <string, string>(); var res = _dictionary.Remove("Key"); res.Should().BeFalse(); _dictionary.AsEnumerable().Should().BeEmpty(); }
public SingleDictionaryTest() { var Dictionary = new Dictionary <string, string>() { { "key", "value" } }; _dictionary = new SingleDictionary <string, string>(Dictionary); }
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>(); }