public void Add_ValidInput_Returns1() { var dict = new ListMultiDictionary <int, int>(); Assert.IsTrue(dict.Add(3, 1)); Assert.IsTrue(dict.Add(3, 2)); Assert.IsTrue(dict[3].SequenceEqual(new[] { 1, 2 })); }
public void Add() { var dict = new ListMultiDictionary <int, int>(); dict.Add(3, new[] { 3, 4, 5 }); Assert.IsTrue(dict[3].SequenceEqual(new[] { 3, 4, 5 })); }
public void Add_DuplicateKey_ThrowsException() { var dict = new ListMultiDictionary <int, int> { [3] = new[] { 1, 2, 3 } }; Assert.ThrowsException <ArgumentException>(() => dict.Add(3, new[] { 3, 4, 5 })); }
public void Equals() { var dict1 = new ListMultiDictionary <int, int> { [3] = new[] { 1, 2, 3, 4 }, [4] = new[] { 5 } }; var dict2 = new ListMultiDictionary <int, int> { [3] = new[] { 1, 2, 3, 4 }, [4] = new[] { 5 } }; Assert.IsTrue(dict1.Equals(dict2)); dict1.Remove(3, 4); Assert.IsFalse(dict1.Equals(dict2)); dict1.Add(3, 4); Assert.IsTrue(dict1.Equals(dict2)); }