o
public virtual void TestHashCodeAndEquals() { MultiPhraseQuery query1 = new MultiPhraseQuery(); MultiPhraseQuery query2 = new MultiPhraseQuery(); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.IsTrue(query1.Equals(query2)); Assert.AreEqual(query1, query2); Term term1 = new Term("someField", "someText"); query1.Add(term1); query2.Add(term1); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.AreEqual(query1, query2); Term term2 = new Term("someField", "someMoreText"); query1.Add(term2); Assert.IsFalse(query1.GetHashCode() == query2.GetHashCode()); Assert.IsFalse(query1.Equals(query2)); query2.Add(term2); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.AreEqual(query1, query2); }
public virtual void TestHashCodeAndEquals() { MultiPhraseQuery query1 = new MultiPhraseQuery(); MultiPhraseQuery query2 = new MultiPhraseQuery(); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.AreEqual(query1, query2); Term term1 = new Term("someField", "someText"); query1.Add(term1); query2.Add(term1); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.AreEqual(query1, query2); Term term2 = new Term("someField", "someMoreText"); query1.Add(term2); Assert.IsFalse(query1.GetHashCode() == query2.GetHashCode()); Assert.IsFalse(query1.Equals(query2)); query2.Add(term2); Assert.AreEqual(query1.GetHashCode(), query2.GetHashCode()); Assert.AreEqual(query1, query2); }