public void CreatePlateauCommand_Should_Call_Create_Method_When_Expected_Value()
        {
            //Given
            var plateauService = new Mock <IPlateauService>();

            var createPlateauCommand = new CreatePlateauCommand(plateauService.Object, 5, 5);

            //When
            createPlateauCommand.Execute();

            //Than
            plateauService.Verify(mock => mock.Create(5, 5), Times.Once);
        }
        public void CreatePlateauCommand_Should_Call_Create_Method_When_Expected_Value(int width, int height)
        {
            //Arrange
            var plateauService = new Mock <IPlateauService>();

            var createPlateauCommand = new CreatePlateauCommand(plateauService.Object, width, height);

            //Act
            createPlateauCommand.Execute();

            //Assert
            plateauService.Verify(mock => mock.Create(width, height), Times.Once);
        }
        public void CreatePlateauMustHaveExpectedSizeOrThrows(string upperDimensions)
        {
            var splittedDimensions = upperDimensions.Split(' ');
            ICommand <Dictionary <Block, Rover> > command = new CreatePlateauCommand();

            if (splittedDimensions.Length == 2)
            {
                var isUpperXParsedSuccessfully = int.TryParse(splittedDimensions[0], out var upperX);
                var isUpperYParsedSuccessfully = int.TryParse(splittedDimensions[1], out var upperY);
                if (!isUpperXParsedSuccessfully)
                {
                    var ex = Assert.Throws <InvalidCastException>(() => command.Execute(upperDimensions));
                    Assert.That(ex.Message, Is.EqualTo("Invalid argument value for parsing upper value of x."));
                }
                else if (!isUpperYParsedSuccessfully)
                {
                    var ex = Assert.Throws <InvalidCastException>(() => command.Execute(upperDimensions));
                    Assert.That(ex.Message, Is.EqualTo("Invalid argument value for parsing upper value of y."));
                }
                else
                {
                    var plateau = command.Execute(upperDimensions);
                    Assert.AreEqual(plateau.Count, (upperX + 1) * (upperY + 1));
                    foreach (var section in plateau)
                    {
                        Assert.NotNull(section.Key);
                        Assert.Null(section.Value);
                    }

                    Assert.AreEqual(plateau.Keys.Max(m => m.X), upperX);
                    Assert.AreEqual(plateau.Keys.Max(m => m.Y), upperY);
                }
            }
            else
            {
                var ex = Assert.Throws <TargetParameterCountException>(() => command.Execute(upperDimensions));
                Assert.That(ex.Message, Is.EqualTo("Invalid size for plateau. It needs two dimensions for creating, also the text must be seperated with space. "));
            }
        }
        public void Setup()
        {
            ICommand <Dictionary <Block, Rover> > createPlateauCommand = new CreatePlateauCommand();

            Plateau = createPlateauCommand.Execute("7 7");
        }