Exemple #1
0
        public void RemoveValueForUnknownValueDoesNotThrow()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>();

            dictionary.AddValue("Key", "Value1");

            Assert.DoesNotThrow(() => dictionary.RemoveValue("Key", "Value2"));
        }
Exemple #2
0
        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"]);
        }
Exemple #5
0
        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 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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #11
0
        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);
        }
Exemple #12
0
        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);
        }
Exemple #13
0
        public void RetrievingUnknownKeyThrows()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>();

            Assert.Throws <KeyNotFoundException>(() => dictionary["foo"]);
        }
        public void RetrievingUnknownKeyThrows()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>();

            Assert.Throws<KeyNotFoundException>(() => dictionary["foo"]);
        }
        public void EmptyDictionary()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>();

            Assert.Equal(0, dictionary.Keys.Count());
        }
Exemple #16
0
        public void RemoveKeyForUnknownKeyDoesNotThrow()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>();

            Assert.DoesNotThrow(() => dictionary.Remove("Key"));
        }
        public void RemoveValueForUnknownKeyDoesNotThrow()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary<string, string>();

            Assert.DoesNotThrow(() => dictionary.RemoveValue("Key", "Value1"));
        }
Exemple #18
0
        public void EmptyDictionary()
        {
            var dictionary = new Xunit.Sdk.MultiValueDictionary <string, string>();

            Assert.Equal(0, dictionary.Keys.Count());
        }
        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);
        }