public void Test_Index_PrepareIndex()
        {
            List <TestRecord> list = new List <TestRecord>();

            for (int i = 0; i < 30; i++)
            {
                TestRecord record = new TestRecord();
                record.ID   = Guid.NewGuid();
                record.Name = "Record " + i;
                record.Text = "Record " + i;

                DataAccess.Data.Saver.Save(record);

                list.Add(record);
            }

            if (DataAccess.Data == null)
            {
                throw new InvalidOperationException("Data provider has not been initialized. Run setup.");
            }

            BaseIndexProjection page = new BaseIndexProjection("Index", typeof(TestRecord), false);

            PagingLocation location = new PagingLocation(0, 20);

            IndexController controller = IndexController.New(page, location);

            if (controller == null)
            {
                throw new Exception("Controller is null.");
            }

            controller.SortExpression = "NameAscending";

            IEntity[] entities = controller.PrepareIndex();

            Assert.IsNotNull(entities, "entities == null");

            Assert.AreEqual(20, entities.Length, "Entity count mismatch.");

            Assert.AreEqual(30, controller.AbsoluteTotal, "Absolute count mismatch.");

            foreach (TestRecord record in list)
            {
                DataAccess.Data.Deleter.Delete(record);
            }
        }