コード例 #1
0
        private static InMemoryCollidableBodies CreateCollidableBodies()
        {
            var movementSpeeds = new DummyMovementSpeeds();
            var bodies         = new DummyBodies();
            var collisions     = new SingleCollision();

            return(InMemoryCollidableBodies.WithCollections(
                       movementSpeeds,
                       bodies,
                       collisions));
        }
コード例 #2
0
        public void Does_not_support_a_null_collection_of_collisions()
        {
            var        movementSpeeds = new DummyMovementSpeeds();
            var        bodies         = new DummyBodies();
            Collisions collisions     = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                InMemoryCollidableBodies.WithCollections(
                    movementSpeeds,
                    bodies,
                    collisions);
            });
        }
コード例 #3
0
        public void That_does_have_one_is_its_movement_speed()
        {
            var movementSpeeds   = new SameMovementSpeeds();
            var bodies           = new DummyBodies();
            var collisions       = new DummyCollisions();
            var collidableBodies = InMemoryCollidableBodies.WithCollections(
                movementSpeeds,
                bodies,
                collisions);
            var entity        = new Guid("9c7aba92-ec3d-4862-a16f-c98214cd4a19");
            var movementSpeed =
                collidableBodies.MovementSpeedForEntity(entity);

            Assert.AreEqual(
                SameMovementSpeeds.MovementSpeed,
                movementSpeed);
        }
コード例 #4
0
        public void Does_not_support_a_null_body()
        {
            var movementSpeeds   = new DummyMovementSpeeds();
            var bodies           = new DummyBodies();
            var collisions       = new DummyCollisions();
            var collidableBodies = InMemoryCollidableBodies
                                   .WithCollections(
                movementSpeeds,
                bodies,
                collisions);
            var  movement = CreateMovement();
            Body body     = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                collidableBodies.CollisionCausedByMovingBody(
                    movement,
                    body);
            });
        }