public virtual void Test() { IQuery qBooks = NewQuery(); qBooks.Constrain(typeof(MultiFieldIndexQueryTestCase.Book)); qBooks.Descend("title").Constrain("Persistence").Like(); IQuery qAuthors = qBooks.Descend("authors"); IQuery qFirstName = qAuthors.Descend("firstName"); IQuery qLastName = qAuthors.Descend("lastName"); IConstraint cAaron = qFirstName.Constrain("Aaron").And(qLastName.Constrain("OneOK" )); IConstraint cBill = qFirstName.Constrain("Bill").And(qLastName.Constrain("TwoOK") ); cAaron.Or(cBill); IObjectSet results = qAuthors.Execute(); Assert.AreEqual(4, results.Count); while (results.HasNext()) { MultiFieldIndexQueryTestCase.Person person = (MultiFieldIndexQueryTestCase.Person )results.Next(); Assert.IsTrue(person.lastName.EndsWith("OK")); } }
/// <exception cref="System.Exception"></exception> protected override void Store() { MultiFieldIndexQueryTestCase.Person aaron = new MultiFieldIndexQueryTestCase.Person ("Aaron", "OneOK"); MultiFieldIndexQueryTestCase.Person bill = new MultiFieldIndexQueryTestCase.Person ("Bill", "TwoOK"); MultiFieldIndexQueryTestCase.Person chris = new MultiFieldIndexQueryTestCase.Person ("Chris", "ThreeOK"); MultiFieldIndexQueryTestCase.Person dave = new MultiFieldIndexQueryTestCase.Person ("Dave", "FourOK"); MultiFieldIndexQueryTestCase.Person neil = new MultiFieldIndexQueryTestCase.Person ("Neil", "Notwanted"); MultiFieldIndexQueryTestCase.Person nat = new MultiFieldIndexQueryTestCase.Person ("Nat", "Neverwanted"); Db().Store(new MultiFieldIndexQueryTestCase.Book("Persistence possibilities", new MultiFieldIndexQueryTestCase.Person[] { aaron, bill, chris })); Db().Store(new MultiFieldIndexQueryTestCase.Book("Persistence using S.O.D.A.", new MultiFieldIndexQueryTestCase.Person[] { aaron })); Db().Store(new MultiFieldIndexQueryTestCase.Book("Persistence using JDO", new MultiFieldIndexQueryTestCase.Person [] { bill, dave })); Db().Store(new MultiFieldIndexQueryTestCase.Book("Don't want to find Phil", new MultiFieldIndexQueryTestCase.Person [] { aaron, bill, neil })); Db().Store(new MultiFieldIndexQueryTestCase.Book("Persistence by Jeff", new MultiFieldIndexQueryTestCase.Person [] { nat })); }