Exemple #1
0
        public void Should_BeBarren_When_SaltIsAdded()
        {
            var squareMeter = new SquareMeter();

            squareMeter.AddSalt();

            Assert.AreEqual(false, squareMeter.IsFertile);
        }
Exemple #2
0
        private SquareMeter[,] GetSquareMetersForLand(int columns, int rows)
        {
            var squareMeters = new SquareMeter[columns, rows];

            for (int y = 0; y < squareMeters.GetLength(1); y++)
            {
                for (int x = 0; x < squareMeters.GetLength(0); x++)
                {
                    squareMeters[x, y] = new SquareMeter();
                }
            }

            return(squareMeters);
        }
Exemple #3
0
        /// <summary>
        /// Creates a Land object using the rectangle provided to define the outside of the land
        /// </summary>
        /// <param name="landDefinition">The rectangle that defines the outside of the land</param>
        /// <returns>Returns a land object</returns>
        public ILand CreateLand(Rectangle landDefinition)
        {
            _logger.Debug($"Entering {nameof(CreateLand)} with {nameof(landDefinition)} = {landDefinition}");

            // Create the square meters to be used in the land.
            var columnsOfLand = landDefinition.XLength;
            var rowsOfLand    = landDefinition.YLength;

            ISquareMeter[,] squareMeters = new ISquareMeter[columnsOfLand, rowsOfLand];
            for (int y = 0; y < squareMeters.GetLength(1); y++)
            {
                for (int x = 0; x < squareMeters.GetLength(0); x++)
                {
                    squareMeters[x, y] = new SquareMeter();
                }
            }

            return(new Land(squareMeters));
        }
Exemple #4
0
        public void Should_BeFertile_When_NewSquareMeterIsCreated()
        {
            var squareMeter = new SquareMeter();

            Assert.AreEqual(true, squareMeter.IsFertile);
        }