﻿using NUnit.Framework;

namespace HackerRank.Tests
{
    [TestFixture]
    public class GameOfStronesTester
    {
        [TestCase(1, "Second")]
        [TestCase(2, "First")]
        [TestCase(3, "First")]
        [TestCase(4, "First")]
        [TestCase(5, "First")]
        [TestCase(6, "First")]
        [TestCase(7, "Second")]
        [TestCase(10, "First")]
        public void OriginalTests(int n, string expected)
        {
            ConsoleAdapterMocker.InitializeAdapter(false);
            ConsoleAdapter.WriteLine(n.ToString());
            GameOfStones.Process();
            Assert.AreEqual(expected, ConsoleAdapter.ReadLine());
        }

        [Test]
        public void OriginalTest()
        {
            string[] inputs =
            {
                "8",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "10"
            };

            string[] expected =
            {
                "Second",
                "First",
                "First",
                "First",
                "First",
                "First",
                "Second",
                "First"
            };

            ConsoleAdapterMocker.InitializeAdapter(false);
            ConsoleAdapterMocker.Write(inputs);
            GameOfStones.Main(null);
            foreach (var result in expected)
            {
                Assert.AreEqual(result, ConsoleAdapter.ReadLine());
            }
        }
    }
}