public void FuzzySuccessFind()
    {
        var nothing = new Material(1, 1);
        var space = new GridBox(new Box(new Position(10, 10, 10), new Position(28, 36, 28)));
        foreach (var block in space.Blocks())
        {
            this.Provider.SetMaterial(this.Filler, block);
        }
        var size = new Position(9, 13, 9);
        var toFind = new Box(new Position(15, 17, 15), new Position(23, 29, 23));
        var randoms = new RandomBlocks(space);
        foreach (var i in Enumerable.Range(0, 100))
        {
            var finishingBlock = randoms
                .Where(b => toFind.Outfits(new Box(b, b)))
                .First();

            var checker = new FilledBoxChecker(this.Surveyor, finishingBlock, size, this.Filler);

            var emptyCount = randoms.Generator.Next(15) + 1;
            var empties = randoms.Where(b => !toFind.Outfits(new Box(b, b))).Take(emptyCount).ToList();
            foreach(var empty in empties)
            {
                this.Provider.SetMaterial(nothing, empty);
            }

            Assert.IsTrue(null != checker.MachineSpace());

            foreach(var empty in empties)
            {
                this.Provider.SetMaterial(this.Filler, empty);
            }
        }
    }
 public void FuzzyFailToFind()
 {
     var nothing = new Material(1, 1);
     var space = new GridBox(new Box(new Position(10, 10, 10), new Position(42, 12, 42)));
     foreach (var block in space.Blocks())
     {
         this.Provider.SetMaterial(this.Filler, block);
     }
     var randoms = new RandomBlocks(space);
     foreach (var i in Enumerable.Range(0, 100))
     {
         var finishingBlock = randoms.First();
         var checker = new FilledBoxChecker(this.Surveyor, finishingBlock, new Position(33, 3, 33), this.Filler);
         var emptyCount = randoms.Generator.Next(15) + 1;
         var empties = randoms.Where(b => b != finishingBlock).Take(emptyCount).ToList();
         foreach(var empty in empties)
         {
             this.Provider.SetMaterial(nothing, empty);
         }
         Assert.AreEqual(null, checker.MachineSpace());
         foreach(var empty in empties)
         {
             this.Provider.SetMaterial(this.Filler, empty);
         }
     }
 }
    public void FindSingleBlock()
    {
        var box = new Box(new Position(10, 10, 10), new Position(10, 10, 10));

        this.Provider.SetMaterial(this.Filler, box.Min);

        var checker = new FilledBoxChecker(this.Surveyor, new Position(10, 10, 10), new Position(1, 1, 1), this.Filler);

        Assert.AreEqual(box, checker.MachineSpace().Value);
    }
    public void FindSimpleBox()
    {
        var box = new Box(new Position(10, 10, 10), new Position(12, 12, 12));
        foreach (var block in new GridBox(box).Blocks())
        {
            this.Provider.SetMaterial(this.Filler, block);
        }

        var checker = new FilledBoxChecker(this.Surveyor, new Position(10, 11, 10), new Position(3, 3, 3), this.Filler);

        Assert.AreEqual(box, checker.MachineSpace().Value);
    }
    public void DoNotGetConfusedByManyPossibilities()
    {
        var box = new Box(new Position(10, 10, 10), new Position(12, 12, 12));
        foreach (var block in new GridBox(new Box(new Position(8, 8, 8), new Position(15, 15, 15))).Blocks())
        {
            this.Provider.SetMaterial(this.Filler, block);
        }

        var finishingBlock = new Position(10, 11, 10);
        var checker = new FilledBoxChecker(this.Surveyor, finishingBlock, new Position(3, 3, 3), this.Filler);
        var grid = new GridBox(checker.MachineSpace().Value);
        Assert.AreEqual(27, grid.BlocksCount());
        Assert.AreEqual(finishingBlock, grid.Blocks().FirstOrDefault(b => b == finishingBlock));
    }