public void Count() { var dict = new OneToManyDictionary <string, int>(); dict.Add("x", 42); dict.Add("y", 66); Assert.AreEqual(dict.Count, 2); }
public void IndexerGet_KeyFound_ReturnsItems() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 2); dict.Add("key", 1); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(2, 1)); }
public void Add_ExistingKey_DuplicateValuesIgnored() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); dict.Add("key", 42); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42)); }
public void Remove_KeyExists_RemovesAllItems() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); dict.Add("key", 43); dict.Remove("key"); Assert.IsFalse(dict.ContainsKey("key")); }
public void IndexerGet_KeyFound_ReturnsItems() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 2); dict.Add("key", 1); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(2, 1)); }
public void Add_ExistingKey_AppendsToList() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); dict.Add("key", 43); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42, 43)); }
public void Keys_ReturnsKeys() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key2", 1); dict.Add("key2", 2); dict.Add("key1", 3); var keys = dict.Keys; Assert.IsTrue(keys.OrderBy(k => k).SequenceEqual("key1", "key2")); }
public void ContainsKey_KeyExists_ReturnsTrue() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); Assert.IsTrue(dict.ContainsKey("key")); }
public void IndexerSet_ExistingKey_EmptyList_ClearsItems() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); dict["key"] = new int[0]; var values = dict["key"]; Assert.IsFalse(values.Any()); }
public void IndexerSet_ExistingKey_ReplacesItems() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); dict["key"] = new[] { 2, 3, 1 }; var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(2, 3, 1)); }
public void Add_NewKey_CreatesList() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42)); }
public void IndexerSet_ExistingKey_EmptyList_ClearsItems() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); dict["key"] = new int[0]; var values = dict["key"]; Assert.IsFalse(values.Any()); }
public void Keys_ReturnsKeys() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key2", 1); dict.Add("key2", 2); dict.Add("key1", 3); var keys = dict.Keys; Assert.IsTrue(keys.OrderBy(k => k).SequenceEqual("key1", "key2")); }
public void IndexerSet_ExistingKey_ReplacesItems() { var dict = new OneToManyDictionary <string, int>(); dict.Add("key", 42); dict["key"] = new[] { 2, 3, 1 }; var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(2, 3, 1)); }
public void Add_ExistingKey_DuplicateValuesIgnored() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); dict.Add("key", 42); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42)); }
public void ContainsKey_KeyExists_ReturnsTrue() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); Assert.IsTrue(dict.ContainsKey("key")); }
public void Remove_KeyExists_RemovesAllItems() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); dict.Add("key", 43); dict.Remove("key"); Assert.IsFalse(dict.ContainsKey("key")); }
public void Count() { var dict = new OneToManyDictionary<string, int>(); dict.Add("x", 42); dict.Add("y", 66); Assert.AreEqual(dict.Count, 2); }
public void Add_NewKey_CreatesList() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42)); }
public void AddRange_ExistingKey_AppendsToList() { var dict = new OneToManyDictionary<string, int>(); dict.Add("key", 42); dict.AddRange("key", new[] { 43, 44 }); var values = dict["key"]; Assert.IsTrue(values.SequenceEqual(42, 43, 44)); }