public void TryGetValue_NullKey() { OccurrenceDictionary dic = new OccurrenceDictionary(); SortedBasicWordInfoSet set = null; dic.TryGetValue(null, out set); }
public void TryGetValue_NullKey() { OccurrenceDictionary dic = new OccurrenceDictionary(); SortedBasicWordInfoSet set = null; Assert.That(() => dic.TryGetValue(null, out set), Throws.ArgumentNullException); }
public void TryGetValue() { OccurrenceDictionary dic = new OccurrenceDictionary(); IDocument doc1 = MockDocument("Doc1", "Doc1", "d", DateTime.Now); IDocument doc2 = MockDocument("Doc2", "Doc2", "d", DateTime.Now); SortedBasicWordInfoSet set = null; Assert.IsFalse(dic.TryGetValue(doc1, out set), "TryGetValue should return false"); Assert.IsNull(set, "Set should be null"); dic.Add(doc1, new SortedBasicWordInfoSet()); Assert.IsTrue(dic.TryGetValue(MockDocument("Doc1", "Doc1", "d", DateTime.Now), out set), "TryGetValue should return true"); Assert.IsNotNull(set, "Set should not be null"); Assert.IsFalse(dic.TryGetValue(doc2, out set), "TryGetValue should return false"); Assert.IsNull(set, "Set should have been set to null"); }
public void TryGetValue_Key_Null() { OccurrenceDictionary sut = new OccurrenceDictionary(); SortedBasicWordInfoSet set = null; var ex = Assert.Throws <ArgumentNullException>("key", () => sut.TryGetValue(null, out set)); }