public void should_increase_id()
 {
     Middle_tank t1 = new Middle_tank(0, 32);
     Middle_tank t2 = new Middle_tank(32, 0);
     int actual = t2.Tank_id - t1.Tank_id;
     Assert.AreEqual(1, actual);
 }
 public void should_move_up()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b_up = new Bullet(0, 32, 16, 0, m);
     //+13, -8
     b_up.Move();
     Assert.AreEqual(13, b_up.X);
     Assert.AreEqual(8, b_up.Y);
 }
 public void should_move_right()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b_right = new Bullet(0, 0, 16, 1, m);
     //+32, +13
     b_right.Move();
     Assert.AreEqual(48, b_right.X);
     Assert.AreEqual(13, b_right.Y);
 }
 public void should_move_down()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b_down = new Bullet(0, 0, 16, 2, m);
     // +13, +32
     b_down.Move();
     Assert.AreEqual(13, b_down.X);
     Assert.AreEqual(48, b_down.Y);
 }
 public void should_move_left()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b_left = new Bullet(32, 0, 16, 3, m);
     //-8, +13
     b_left.Move();
     Assert.AreEqual(8, b_left.X);
     Assert.AreEqual(13, b_left.Y);
     Assert.AreEqual(32, b_left.Tank_owner.X);
 }
 public void Tank_should_move_down_with_its_own_Speed()
 {
     Middle_tank t = new Middle_tank(32, 0);
     t.Move_down();
     Assert.AreEqual(t.Speed, t.Y);
     t.Move_down();
     Assert.AreEqual(t.Speed * 2, t.Y);
     t.Move_down();
     Assert.AreEqual(t.Speed * 3, t.Y);
 }
Exemple #7
0
        public Map()
        {
            // деревья
            list_of_Trees.Add(new Forest(32 * 12, 32 * 12));
            list_of_Trees.Add(new Forest(32 * 8, 32 * 8));
            list_of_Trees.Add(new Forest(32 * 10, 32 * 10));
            list_of_Trees.Add(new Forest(32 * 6, 32 * 6));
            list_of_Trees.Add(new Forest(32 * 4, 32 * 4));
            list_of_Trees.Add(new Forest(32 * 2, 32 * 2));

            // танки
            Tank t1 = new Middle_tank(32, 32);
            t1.On_Shoot += Tank_on_Shoot;
            Tank t2 = new Middle_tank(96, 32);
            t2.On_Shoot += Tank_on_Shoot;
            list_of_Tanks.Add(t1);
            list_of_Tanks.Add(t2);
        }
 public void should_not_belong_to_Player()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b = new Bullet(32, 32, 16, 1, m);
     Assert.AreNotEqual(typeof(Player_tank), b.Tank_owner.GetType());
 }
 public void should_call_owner()
 {
     Middle_tank m = new Middle_tank(32, 32);
     Bullet b = new Bullet(32, 32, 16, 1, m);
     Assert.AreEqual(m, b.Tank_owner);
 }