예제 #1
0
 protected bool Equals(IGameField other)
 {
     return(Size == other.Size &&
            other.EnumeratePositions()
            .All(position => this[position].Damaged == other[position].Damaged &&
                 this[position].GetType() == other[position].GetType()));
 }
예제 #2
0
        public void ReturnCorrectValuesByIndex()
        {
            foreach (var position in field.EnumeratePositions())
            {
                var cell          = field[position];
                var symbolInField = SampleField[position.Row][position.Column];

                if (symbolInField == 'X')
                {
                    cell.Should().BeAssignableTo <IShipCell>();
                }
                else
                {
                    cell.Should().BeAssignableTo <IEmptyCell>();
                }

                cell.Damaged.Should().BeFalse();
            }
        }