public void Remove_Pair() { OccurrenceDictionary dic = new OccurrenceDictionary(); dic.Add(MockDocument("Doc1", "Doc1", "d", DateTime.Now), new SortedBasicWordInfoSet()); dic.Add(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet()); Assert.Equal(2, dic.Count); Assert.False(dic.Remove(new KeyValuePair <IDocument, SortedBasicWordInfoSet>(MockDocument("Doc3", "Doc3", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return false"); Assert.True(dic.Remove(new KeyValuePair <IDocument, SortedBasicWordInfoSet>(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return true"); Assert.Single(dic); }
public void Remove_KV() { OccurrenceDictionary dic = new OccurrenceDictionary(); SortedBasicWordInfoSet set = new SortedBasicWordInfoSet(); set.Add(new BasicWordInfo(5, 0, WordLocation.Content)); dic.Add(MockDocument("Doc1", "Doc1", "d", DateTime.Now), set); dic.Add(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet()); Assert.AreEqual(2, dic.Count, "Wrong initial count"); Assert.IsFalse(dic.Remove(MockDocument("Doc3", "Doc3", "d", DateTime.Now)), "Remove should return false"); Assert.IsTrue(dic.Remove(MockDocument("Doc1", "Doc1", "d", DateTime.Now)), "Remove should return true"); Assert.AreEqual(1, dic.Count, "Wrong count"); }
public void Remove_KV_Key_Null() { OccurrenceDictionary sut = new OccurrenceDictionary(); var ex = Assert.Throws <ArgumentNullException>(() => sut.Remove(null as IDocument)); Assert.Equal("Value cannot be null.\r\nParameter name: key", ex.Message); }
public void Remove_Pair() { var dic = new OccurrenceDictionary(); dic.Add(MockDocument("Doc1", "Doc1", "d", DateTime.Now), new SortedBasicWordInfoSet()); dic.Add(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet()); Assert.AreEqual(2, dic.Count, "Wrong initial count"); Assert.IsFalse(dic.Remove( new KeyValuePair <IDocument, SortedBasicWordInfoSet>(MockDocument("Doc3", "Doc3", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return false"); Assert.IsTrue(dic.Remove( new KeyValuePair <IDocument, SortedBasicWordInfoSet>(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return true"); Assert.AreEqual(1, dic.Count, "Wrong count"); }
public void Remove_KV_NullKey() { OccurrenceDictionary dic = new OccurrenceDictionary(); dic.Remove(null as IDocument); }
public void Remove_KV_NullKey() { OccurrenceDictionary dic = new OccurrenceDictionary(); Assert.That(() => dic.Remove(null as IDocument), Throws.ArgumentNullException); }
public void Remove_Pair() { OccurrenceDictionary dic = new OccurrenceDictionary(); dic.Add(MockDocument("Doc1", "Doc1", "d", DateTime.Now), new SortedBasicWordInfoSet()); dic.Add(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet()); Assert.AreEqual(2, dic.Count, "Wrong initial count"); Assert.IsFalse(dic.Remove( new KeyValuePair<IDocument, SortedBasicWordInfoSet>(MockDocument("Doc3", "Doc3", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return false"); Assert.IsTrue(dic.Remove( new KeyValuePair<IDocument, SortedBasicWordInfoSet>(MockDocument("Doc2", "Doc2", "d", DateTime.Now), new SortedBasicWordInfoSet())), "Remove should return true"); Assert.AreEqual(1, dic.Count, "Wrong count"); }