Пример #1
0
        public void SolveWithArbitraryDataStuctureAndCustomPredicate()
        {
            // Arrange
            var data = new List <Tuple <char[], string> >
            {
                Tuple.Create(new[] { 'X', 'O', 'O' }, "Some data associated with row 0"),
                Tuple.Create(new[] { 'O', 'X', 'O' }, "Some data associated with row 1"),
                Tuple.Create(new[] { 'O', 'O', 'X' }, "Some data associated with row 2")
            };

            // Act
            var solutions = new Dlx().Solve(data, d => d, r => r.Item1, c => c == 'X').ToList();

            // Assert
            Assert.That(solutions, Has.Count.EqualTo(1));
            Assert.That(solutions.Select(s => s.RowIndexes), Contains.Item(new[] { 0, 1, 2 }));
        }