public void ToDictionary_003() { NameValueCollection target = null; var actual = NameValueCollectionExtensions.ToDictionary(target); Assert.IsNotNull(actual); Assert.IsInstanceOfType(actual, typeof(IDictionary <string, object>)); Assert.AreEqual(0, actual.Count); }
public void ToDictionary_001() { var target = new NameValueCollection(); target.Add("Key", "One"); var actual = NameValueCollectionExtensions.ToDictionary(target); Assert.IsInstanceOfType(actual, typeof(IDictionary <string, object>)); Assert.AreEqual(1, actual.Count); Assert.AreEqual("Key", actual.Keys.First()); Assert.AreEqual("One", actual["Key"]); }
public void WhenSourceIsNull_ThenThrowException() { Assert.Throws <ArgumentNullException>(() => NameValueCollectionExtensions.ToDictionary(null)); }