public void Set_throws_if_key_missing() { var data = new Dictionary <string, string> { { "key1", "value1" } }; var carrier = new DictionaryCarrier(data); Assert.Throws <ArgumentNullException>(() => carrier.Set(null, "value")); }
public void Get_returns_null_if_key_is_not_found() { var data = new Dictionary <string, string> { { "key1", "value1" } }; var carrier = new DictionaryCarrier(data); Assert.Null(carrier.Get("invalid")); }
public void Set_succeeds_if_new_key() { var data = new Dictionary <string, string> { { "key1", "value1" } }; var carrier = new DictionaryCarrier(data); carrier.Set("key2", "value2"); Assert.Equal(2, data.Count); }
public void Set_overwrites_existing_key() { var data = new Dictionary <string, string> { { "key1", "value1" } }; var carrier = new DictionaryCarrier(data); carrier.Set("key1", "value2"); Assert.Equal(1, data.Count); Assert.Equal("value2", data["key1"]); }
public void Get_returns_correct_value() { var data = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" } }; var carrier = new DictionaryCarrier(data); var result = carrier.Get("key2"); Assert.Equal("value2", result); }
public void GetEntries_returns_all_entries() { var data = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" } }; var carrier = new DictionaryCarrier(data); var resultEntries = carrier.GetEntries(); Assert.True(resultEntries.SequenceEqual(data)); }