コード例 #1
0
ファイル: GameField.cs プロジェクト: jvmusin/GamePractice
 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();
            }
        }