public void TestEqualsMethodShouldReturnFalseIfSecondPositionObjectsIsNull()
        {
            var firstPosition = new Position(1, 1);

            var expected = false;
            var actual = firstPosition.Equals(null);

            Assert.AreEqual(expected, actual, "Method Equals should return false if the second Position objects is null");
        }
        public void TestGetHashCodeMethodShouldReturnProperlyHashValue()
        {
            int row = 1;
            int col = 2;
            var position = new Position(row, col);
            var expected = row ^ col;
            var actual = position.GetHashCode();

            Assert.AreEqual(expected, actual, "GetHashCode method should calculate properly hash value");
        }
        public void TestEqualsOperatorShouldReturnTrueIfTwoPositionObjectsAreEqual()
        {
            var firstPosition = new Position(1, 1);
            var secondPosition = new Position(1, 1);

            var expected = true;
            var actual = firstPosition == secondPosition;

            Assert.AreEqual(expected, actual, "Operator == should return true if two Position objects are equal");
        }
        public void TestEqualsMethodShouldReturnTrueIfTwoPositionObjectsAreEqual()
        {
            var firstPosition = new Position(1, 1);
            var secondPosition = new Position(1, 1);

            var expected = true;
            var actual = firstPosition.Equals(secondPosition);

            Assert.AreEqual(expected, actual, "Method Equals should return true if two Position objects are equal");
        }
        public void TestMediumPlayfieldSetCellMethodUsingIPositionShouldProperlySetSymbolInGridAndGetMethodShouldReturnIt()
        {
            var playfield = new MediumPlayfield();
            IPosition position = new Position(0, 0);

            var rng = new RandomNumberGenerator();
            playfield.FillPlayfield(rng);

            playfield.SetCell(position.Row, position.Col, "@");
            string actual = playfield.GetCell(position.Row, position.Col);
            string expected = "@";

            Assert.AreEqual(expected, actual, "At position 0,0 the symbol should be @");
        }
        /// <summary>
        /// Check if two positions are equal based on their row and col
        /// </summary>
        /// <param name="p">Position that is compared with this position</param>
        /// <returns>Are this two positions are equal</returns>
        public bool Equals(Position p)
        {
            if ((object)p == null)
            {
                return false;
            }

            return (this.row == p.row) && (this.col == p.col);
        }
 public void TestColPropertyShouldThrowIfNegativeNumberIsGiven()
 {
     var position = new Position(1, -1);
 }
 public void TestRowPropertyShouldThrowIfNegativeNumberIsGiven()
 {
     var position = new Position(-1, 1);
 }