public void AddsKeyIfDoesntExist() { var dictionary = new Dictionary<string, string>(); var result = dictionary.AddOnlyIfDoesntExist("hello", "goodbye"); Assert.True(result); Assert.Equal("goodbye", dictionary["hello"]); }
public void ReturnsFalseWhenKeyIsNotAdded() { var dictionary = new Dictionary<string, string> { {"hello", "goodbye"} }; var result = dictionary.AddOnlyIfDoesntExist("hello", "goodbye2"); Assert.False(result); Assert.Equal("goodbye", dictionary["hello"]); }