Exemplo n.º 1
0
        public void GetObjectsWhereReturnsOnlyIndexedObjectsByFieldValue()
        {
            var i = new IndexData <Sword>();

            i.AddField("Name");
            i.IndexObject(excalibur, 1);
            Assert.Contains(excalibur, i.GetObjectsWhere("Name", excalibur.Name));

            i.AddField("Cost");
            Assert.Contains(excalibur, i.GetObjectsWhere("Cost", excalibur.Cost.ToString()));

            i.IndexObject(calendor, 2);
            Assert.Contains(calendor, i.GetObjectsWhere("Name", calendor.Name));
            Assert.Contains(calendor, i.GetObjectsWhere("Cost", calendor.Cost.ToString()));

            i.RemoveObject(excalibur);
            Assert.IsFalse(i.GetObjectsWhere("Name", excalibur.Name).Contains(excalibur));
            Assert.IsFalse(i.GetObjectsWhere("Cost", excalibur.Cost.ToString()).Contains(excalibur));
        }