public void Remove_returns_true_on_key_value_pair_present() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "a"); Assert.True(map.Remove("hello", "a")); }
public void Remove_returns_false_on_missing_key_value_pair() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "a"); Assert.False(map.Remove("hello", "z")); }
public void Add_should_not_store_duplicate_values() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "v"); map.Add("hello", "v"); Assert.HasCount(1, map); }
public void Keys_and_whole_list_is_empty_on_removed_all_items() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "a"); map.Remove("hello", "a"); Assert.Null(map["hello"]); Assert.Empty(map); }
public void Add_should_store_and_Indexer_should_retrieve_multiple_values() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "a"); map.Add("hello", "b"); Assert.HasCount(2, map["hello"]); Assert.Equal(new [] { "a", "b" }, map["hello"].Cast <string>()); }
public void Add_should_store_and_Remove_should_remove_values() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("hello", "a"); map.Add("hello", "b"); map.Add("hello", "c"); Assert.True(map.Remove("hello", "a")); Assert.HasCount(2, map["hello"]); Assert.Equal(new [] { "b", "c" }, map["hello"].Cast <string>()); }
public void GetEnumerator_should_process_all_key_value_pairs() { var map = new FrugalMultimap <string, string>(StringComparer.Ordinal); map.Add("a", "a"); map.Add("a", "b"); map.Add("b", "b"); Assert.Equal(new [] { new KeyValuePair <string, string>("a", "a"), new KeyValuePair <string, string>("a", "b"), new KeyValuePair <string, string>("b", "b"), }, map.ToArray()); }