using Microsoft.VisualStudio.TestTools.UnitTesting;
using SpaceInvaders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpaceInvaders.Tests
{
    [TestClass()]
    public class GameTests
    {
        Random random = new Random();
        [TestMethod()]
        public void GetPlayerNameTest()
        {
            //Arrange
            string player = "Player";
            int id  = 0;
            //Act
            id = (byte)random.Next(0, 10);
            //Assert
            Assert.IsTrue("Player" == player);
            Assert.IsTrue(!player.Equals(id));
        }

        [TestMethod()]
        public void PlayerTestRight()
        {
            // Arrange
            var game = new Game();
            game.intHPlayerPosition = Console.WindowWidth / 2; ; 
            var initialPosition = game.intHPlayerPosition;

            // Act
            var key = Console.ReadKey(true);
            if (key.Key == ConsoleKey.RightArrow)
            {
                game.intHPlayerPosition++;
                
            }

            // Assert
            Assert.AreEqual(initialPosition+1,game.intHPlayerPosition++);
        }

        [TestMethod()]
        public void PlayerTestLeft()
        {
            // Arrange
            var game = new Game();
            game.intHPlayerPosition = Console.WindowWidth / 2; ;
            var initialPosition = game.intHPlayerPosition;

            // Act
            var key = Console.ReadKey(true);
            if (key.Key == ConsoleKey.LeftArrow)
            {
                game.intHPlayerPosition--;

            }

            // Assert
            Assert.AreEqual(initialPosition - 1, game.intHPlayerPosition++);
        }

    }
}