Example #1
0
        public void AddToTest()
        {
            var ctx = new SimulationContext(true);

            Random        random       = new Random();
            List <Entity> testEntities = CreateEntities(ctx.LocalSpace, 100);

            EntityPool original = new EntityPool(ctx);

            foreach (var e in testEntities)
            {
                Assert.IsTrue(original.Insert(e));
            }
            original.VerifyIntegrity();

            var h0 = original.HashDigest;

            for (int i = 0; i < 100; i++)
            {
                EntityPool compare = new EntityPool(ctx);
                random.Shuffle(testEntities);
                foreach (var e in testEntities)
                {
                    Assert.IsTrue(compare.Insert(e));
                }
                compare.VerifyIntegrity();
                var h1 = compare.HashDigest;
                Assert.AreEqual(h0, h1);
            }
        }