コード例 #1
0
        protected StrategyTestsBase()
        {
            FieldMock.Setup(x => x.GetRow(It.IsAny <int>()))
            .Returns((int i) => Field.GetRow(i));

            FieldMock.Setup(x => x.GetRow(It.IsAny <Square>()))
            .Returns((Square s) => Field.GetRow(s));

            FieldMock.Setup(x => x.GetColumn(It.IsAny <int>()))
            .Returns((int i) => Field.GetColumn(i));

            FieldMock.Setup(x => x.GetColumn(It.IsAny <Square>()))
            .Returns((Square s) => Field.GetColumn(s));

            FieldMock.Setup(x => x.GetBigSquare(It.IsAny <int>()))
            .Returns((int i) => Field.GetBigSquare(i));

            FieldMock.Setup(x => x.GetBigSquare(It.IsAny <Square>()))
            .Returns((Square s) => Field.GetBigSquare(s));
        }
コード例 #2
0
        private void RemoveCandidatesInGroups(Square square)
        {
            var affectedSquares = _field.GetRow(square);

            affectedSquares.AddRange(_field.GetColumn(square));
            affectedSquares.AddRange(_field.GetBigSquare(square));

            foreach (var affectedSquare in affectedSquares.Where(x => x.Value == 0))
            {
                affectedSquare.Candidates.Remove(square.Value);
            }
        }