public void Customize(IFixture fixture)
        {
            fixture.Customize <Tissue2D>(c => c.FromFactory(() =>
            {
                var maxX = _rnd.Next(1, _maxValue);
                var maxY = _rnd.Next(1, _maxValue);

                var locations = new List <Location>();
                for (int y = 0; y < maxY; y++)
                {
                    for (int x = 0; x < maxX; x++)
                    {
                        locations.Add(new Location(x, y));
                    }
                }

                ImmutableDictionary <Location, ICell> tissue = locations
                                                               .Aggregate(
                    ImmutableDictionary <Location, ICell> .Empty,
                    (result, next) =>
                    result.Add(next, fixture.Create <ICell>())
                    );
                tissue.Count().Should().Be(maxX * maxY);
                return(new Tissue2D(tissue));
            }));
        }
 public ConstraintSatisfactionProblem(IEnumerable <Variable <Tval> > variables, IEnumerable <Constraint <Tval> > constraints = null)
 {
     if (variables == null)
     {
         throw new ArgumentNullException("variables");
     }
     Variables = ImmutableArray.Create(variables.ToArray());
     Console.WriteLine("Variables: " + Variables.Length);
     Constraints = (constraints != null) ? ImmutableArray.Create(constraints.ToArray()) : ImmutableArray.Create <Constraint <Tval> >();
     Console.WriteLine("Constraints: " + Constraints.Length);
     NeighboursTable = CreateNeighboursArcs(Constraints).ToImmutableDictionary();
     Console.WriteLine("NeighboursTable: " + NeighboursTable.Count());
     arcs = CreateListOfArcs();
     Console.WriteLine("Arcs: " + arcs.Count());
     VariableArcsTable = CreateVariableArcsTable(NeighboursTable).ToImmutableDictionary();
 }