コード例 #1
0
ファイル: WorldTest.cs プロジェクト: julius/pse_spacewar
        public void RemoveWorldObjectTest()
        {
            Projectile projectile1 = new Projectile();
            Projectile projectile2 = new Projectile();
            Spaceship spaceship = new Spaceship();
            Planet planet = new Planet();
            Explosion explosion = new Explosion();

            WorldObject[] worldObjects = { projectile1, projectile2, spaceship, planet, explosion };

            World target = new World(worldObjects);
            target.RemoveWorldObject(projectile1);
            target.RemoveWorldObject(projectile2);
            target.RemoveWorldObject(spaceship);
            target.RemoveWorldObject(explosion);

            Assert.IsFalse((new List<WorldObject>(target.WorldObjects)).Contains(projectile1));
            Assert.IsFalse((new List<WorldObject>(target.WorldObjects)).Contains(projectile2));
            Assert.IsFalse((new List<WorldObject>(target.WorldObjects)).Contains(spaceship));
            Assert.IsFalse((new List<WorldObject>(target.WorldObjects)).Contains(explosion));
            Assert.IsTrue((new List<WorldObject>(target.WorldObjects)).Contains(planet));
        }