public void TestCreatePlayfieldWithSomeDifferentAsParameterShouldCreateNull()
        {
            string typeOfPlayfield = "wrong";
            IPlayfieldFactory factory = new PlayfieldFactory();
            var playfield = factory.CreatePlayfield(typeOfPlayfield);

            Assert.IsNull(playfield, "CreatePlayfield with wrong argument should create null ");
        }
        public void TestCreatePlayfieldWithSmallAsParameterShouldCreateNewSmallPlayfieldObject()
        {
            string typeOfPlayfield = "small";
            IPlayfieldFactory factory = new PlayfieldFactory();
            var playfield = factory.CreatePlayfield(typeOfPlayfield);
            var actual = playfield.GetType() == typeof(SmallPlayfield);

            Assert.IsTrue(actual, "CreatePlayfield with small as argument should create new SmallPlayfield Object");
        }
        private static void ProceedCommand(string command)
        {
            var randomNumberGenerator = new RandomNumberGenerator();
            var reader = new ConsoleReader();
            var renderer = new ConsoleRenderer();
            var factory = new PlayfieldFactory();

            switch (command)
            {
                case "New game":
                    Playfield playfield;
                    Console.Clear();
                    Console.WriteLine(ChooseSizeMessage);

                    string size = Console.ReadLine();

                    playfield = factory.CreatePlayfield(size);
                    playfield.FillPlayfield(randomNumberGenerator);

                    if (playfield == null)
                    {
                        Console.Clear();
                        Console.WriteLine(ChooseSizeMessage);
                        ProceedCommand("New game");
                    }
                    else
                    {
                        var game = new GameEngine(reader, renderer, playfield);
                        game.Run();
                    }

                    break;
                case "Load game":
                    try
                    {
                        var fileSerializer = new FileSerializer();
                        var memento = fileSerializer.DeserializeObject(GameLocation);
                        playfield = factory.CreatePlayfield(ConvertNumberToString(memento.Grid.GetLength(0)));
                        playfield.RestoreMemento(memento);

                        File.Delete(GameLocation);

                        var game = new GameEngine(reader, renderer, playfield);
                        game.Run();
                    }
                    catch (Exception ex)
                    {
                        Console.Clear();
                        Console.WriteLine(ex.Message);
                        Console.WriteLine(WelcomeMessage);
                        ProceedCommand(Console.ReadLine());
                    }

                    break;
                case "Exit":
                    Environment.Exit(0);
                    break;
                default:
                    Console.Clear();
                    Console.WriteLine(WelcomeMessage);
                    ProceedCommand(Console.ReadLine());
                    break;
            }
        }