public void SynchronizedContext_ContextFromWorld_IsValidInWorldAfterCreation()
 {
     using (var world = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
     {
         using (var context = SynchronizedContext.CreateFromWorld(world))
         {
             Assert.That(context.IsValidIn(world));
         }
     }
 }
 public void SynchronizedContext_ContextFromWorld_IsInvalidAfterEntityCreated()
 {
     using (var world = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
     {
         using (var context = SynchronizedContext.CreateFromWorld(world))
         {
             world.EntityManager.CreateEntity();
             Assert.IsFalse(context.IsValidIn(world));
         }
     }
 }
 public void SynchronizedContext_ContextFromWorld_IsNotValidInDifferentWorld()
 {
     using (var worldA = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
         using (var worldB = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
         {
             using (var context = SynchronizedContext.CreateFromWorld(worldA))
             {
                 Assert.IsFalse(context.IsValidIn(worldB));
             }
         }
 }
 public void SynchronizedContext_ContextFromWorld_IsInvalidAfterSystemUpdate()
 {
     using (var world = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
     {
         var system = world.CreateSystem <SynchronizedContext_TestSystem>();
         using (var context = SynchronizedContext.CreateFromWorld(world))
         {
             system.Update();
             Assert.IsFalse(context.IsValidIn(world));
         }
     }
 }
Пример #5
0
        public void HashUtility_GetWorldHashZeroedPadding_DoesNotTriggerWorldWrites()
        {
            using (var world = DeterminismTestUtility.CreateTestWorld_WithLocalToWorldComponents(worldName, 1))
                using (var context = SynchronizedContext.CreateFromWorld(world))
                {
                    // move BeforeStructuralChange() outside of GetWorldHash() as it would otherwise indeed modify the world
                    SanityCheckHashValue(HashUtility.GetWorldHash(world, MaskedHasher, SeedForTesting));

                    // if the global system version was bumped, the context is invalid:
                    Assert.That(context.IsValidIn(world));
                }
        }