Ejemplo n.º 1
0
        public void ReadAllComponentTypes_Should_callback_reader()
        {
            using World world = new World(42);

            bool intIsOk   = false;
            bool longIsOk  = false;
            bool floatIsOk = true;

            world.SetMaximumComponentCount <int>(1);
            world.GetAllComponents <long>();

            IComponentTypeReader reader = Substitute.For <IComponentTypeReader>();

            reader.When(m => m.OnRead <int>(1)).Do(_ => intIsOk    = true);
            reader.When(m => m.OnRead <long>(42)).Do(_ => longIsOk = true);
            reader.When(m => m.OnRead <float>(Arg.Any <int>())).Do(_ => floatIsOk = false);

            world.ReadAllComponentTypes(reader);

            Check.That(intIsOk).IsTrue();
            Check.That(longIsOk).IsTrue();
            Check.That(floatIsOk).IsTrue();
        }
Ejemplo n.º 2
0
 public ComponentTypeReadMessage(IComponentTypeReader reader)
 {
     Reader = reader;
 }