public void AddSameValueForSameKeyDoesNotDuplicateValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value1"); Assert.Contains("Key", dictionary.Keys); IEnumerable<string> values = dictionary["Key"]; Assert.Single(values); Assert.Contains("Value1", values); }
public void AddTwoValuesForSameKey() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value2"); Assert.Contains("Key", dictionary.Keys); IEnumerable<string> values = dictionary["Key"]; Assert.Contains("Value1", values); Assert.Contains("Value2", values); }
public void AddSameValueForSameKeyDoesNotDuplicateValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value1"); Assert.Contains("Key", dictionary.Keys); IEnumerable <string> values = dictionary["Key"]; Assert.Single(values); Assert.Contains("Value1", values); }
public void AddTwoValuesForSameKey() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value2"); Assert.Contains("Key", dictionary.Keys); IEnumerable <string> values = dictionary["Key"]; Assert.Contains("Value1", values); Assert.Contains("Value2", values); }
public void RemoveValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value2"); dictionary.RemoveValue("Key", "Value1"); Assert.Contains("Key", dictionary.Keys); IEnumerable <string> values = dictionary["Key"]; Assert.DoesNotContain("Value1", values); Assert.Contains("Value2", values); }
public void RemoveValueForUnknownValueDoesNotThrow() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value1"); Assert.DoesNotThrow(() => dictionary.RemoveValue("Key", "Value2")); }
public void CanEnumerateKeysAndValuesWithDelegate() { string result = ""; var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key1", "Value1"); dictionary.AddValue("Key2", "Value2"); dictionary.AddValue("Key2", "Value1"); dictionary.AddValue("Key3", "Value7"); dictionary.ForEach((key, value) => result += key + ": " + value + "\r\n"); Assert.Equal("Key1: Value1\r\n" + "Key2: Value2\r\n" + "Key2: Value1\r\n" + "Key3: Value7\r\n", result); }
public void AddSingleValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value"); Assert.Contains("Key", dictionary.Keys); Assert.Contains("Value", dictionary["Key"]); }
public void RemoveKey() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value"); dictionary.Remove("Key"); Assert.DoesNotContain("Key", dictionary.Keys); }
public void AddSingleValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value"); Assert.Contains("Key", dictionary.Keys); Assert.Contains("Value", dictionary["Key"]); }
public void RemoveKey() { var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>(); dictionary.AddValue("Key", "Value"); dictionary.Remove("Key"); Assert.DoesNotContain("Key", dictionary.Keys); }
public void RemoveValue() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value1"); dictionary.AddValue("Key", "Value2"); dictionary.RemoveValue("Key", "Value1"); Assert.Contains("Key", dictionary.Keys); IEnumerable<string> values = dictionary["Key"]; Assert.DoesNotContain("Value1", values); Assert.Contains("Value2", values); }
public void CanEnumerateKeysAndValuesWithDelegate() { string result = ""; var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key1", "Value1"); dictionary.AddValue("Key2", "Value2"); dictionary.AddValue("Key2", "Value1"); dictionary.AddValue("Key3", "Value7"); dictionary.ForEach((key, value) => result += key + ": " + value + "\r\n"); Assert.Equal("Key1: Value1\r\n" + "Key2: Value2\r\n" + "Key2: Value1\r\n" + "Key3: Value7\r\n", result); }
public void RemoveValueForUnknownValueDoesNotThrow() { var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>(); dictionary.AddValue("Key", "Value1"); Assert.DoesNotThrow(() => dictionary.RemoveValue("Key", "Value2")); }