public void TryGetValueAndRemove_IfTheKeyExists_ShouldReturnTrue() { const string key = "TestKey"; Dictionary<string, string> dictionary = new Dictionary<string, string> {{key, "TestValue"}}; string outValue; Assert.IsTrue(dictionary.TryGetValueAndRemove(key, out outValue)); }
public void TryGetValueAndRemove_IfTheKeyExists_ShouldSetTheOutValue() { const string key = "TestKey"; const string value = "TestValue"; Dictionary<string, string> dictionary = new Dictionary<string, string> {{key, value}}; string outValue; dictionary.TryGetValueAndRemove(key, out outValue); Assert.AreEqual(value, outValue); }
public void TryGetValueAndRemove_IfTheKeyExists_ShouldRemoveTheKey() { const string key = "TestKey"; Dictionary<string, string> dictionary = new Dictionary<string, string> {{key, "TestValue"}}; Assert.AreEqual(1, dictionary.Count); string outValue; dictionary.TryGetValueAndRemove(key, out outValue); Assert.AreEqual(0, dictionary.Count); }