public void EntityPoolTest()
        {
            var people = Enumerable.Range(1, 1000).Select(z => new Order
            {
                OrderId   = z,
                OrderDate = DateTime.Today.AddDays(z)
            }).ToList();

            var children = Enumerable.Range(1, 10000).Select(z => new ProductLine
            {
                OrderId       = (int)Math.Ceiling(z / 10.0f),
                ProductCode   = "Child " + z,
                ProductLineId = z
            }).ToList();


            var pool = new TestBuilder().CreateEntityPool();

            pool.AddEntities(people);
            pool.AddEntities(children);


            Assert.IsTrue(people.All(x => x.ProductLines.All(c => c.OrderId == x.OrderId)));
            Assert.IsTrue(children.All(c => c.Order.OrderId == c.OrderId));
        }
        public void MatchFromMidLevelTypeRelationshipTest()
        {
            var people = Enumerable.Range(1, 10).Select(z => new Order2
            {
                OrderId   = z,
                OrderDate = DateTime.Today.AddDays(z)
            }).ToList();

            var links1 = Enumerable.Range(1, 10).Select(z => new LinkedClass2
            {
                OrderId = z,
                Id      = z * 2
            }).ToList();


            var links2 = Enumerable.Range(1, 10).Select(z => new LinkedClass1
            {
                OrderId = z,
                Id      = z * 2
            }).ToList();


            var children = Enumerable.Range(1, 100).Select(z => new ProductLine
            {
                OrderId       = (int)Math.Ceiling(z / 10.0f),
                ProductCode   = "Child " + z,
                ProductLineId = z
            }).ToList();


            var pool = new TestBuilder().CreateEntityPool();

            pool.AddEntities(people);
            pool.AddEntities(children);
            pool.AddEntities(links1);
            pool.AddEntities(links2);

            Assert.IsTrue(people.All(x => x.ProductLines.All(c => c.OrderId == x.OrderId)));
            Assert.IsTrue(children.All(c => c.Order.OrderId == c.OrderId));
            Assert.IsTrue(people.All(c => c.Link1.OrderId == c.OrderId));
            Assert.IsTrue(people.All(c => c.Link2.OrderId == c.OrderId));
        }
        public void MatchFromTopLevelTypeRelationshipUsingBaseTypeFromPolymorphicListTest()
        {
            var people = Enumerable.Range(1, 10).Select(z => new Order1
            {
                OrderId   = z,
                OrderDate = DateTime.Today.AddDays(z)
            }).ToList();

            var links = Enumerable.Range(1, 10).Select(z => new LinkedClass1
            {
                OrderId = z,
                Id      = z * 2
            }).ToList();

            var pool = new TestBuilder().CreateEntityPool();

            pool.AddEntities(people.OfType <Order>());
            pool.AddEntities(links);

            Assert.IsTrue(people.All(x => x.ProductLines.All(c => c.OrderId == x.OrderId)));
            Assert.IsTrue(people.All(c => c.Link1.OrderId == c.OrderId));
        }