public void Test4()
        {
            var grid = new BinaryGrid <string>();

            grid.Set(new IntVector(10, 10, 0), "a");

            Assert.AreEqual("a", grid.Get(new IntVector(10, 10, 0)));
        }
        public void Test7()
        {
            var grid = new BinaryGrid <string>();

            var result = grid.Set(new IntVector(-10, -10, 0), "a");

            Assert.AreEqual(new IntVector(-12, -12, 0), result.OffsetShift);
            Assert.AreEqual("a", grid.Get(new IntVector(-10, -10, 0)));
        }
        public void Test8()
        {
            var grid = new BinaryGrid <string>();

            var itemsToEnumerate = new Dictionary <IntVector, string>
            {
                { new IntVector(1, 0, 0), "a" },
                { new IntVector(2, 0, 0), "b" },
                { new IntVector(2, 1, 0), "c" },
                { new IntVector(3, 1, 0), "d" }
            };

            var itemsToIgnore = new Dictionary <IntVector, string>
            {
                { new IntVector(0, 1, 0), "a" },
                { new IntVector(1, 2, 0), "b" },
                { new IntVector(2, 2, 0), "c" },
                { new IntVector(3, 2, 0), "d" }
            };

            foreach (var pair in itemsToEnumerate.Concat(itemsToIgnore))
            {
                grid.Set(pair.Key, pair.Value);
            }

            var bounds = IntRectangle.FromXYZWidthHeightDepth(1, 0, 0, 3, 2, 1);

            var enumeratedItems = new Dictionary <IntVector, string>();

            grid.ForEachWithin(bounds, (item, position) => enumeratedItems.Add(position, item));

            foreach (var pair in itemsToEnumerate)
            {
                Assert.IsTrue(enumeratedItems.ContainsKey(pair.Key), "Item at position " + pair.Key + " was not enumerated.");
                Assert.AreEqual(pair.Value, enumeratedItems[pair.Key]);
            }

            Assert.AreEqual(itemsToEnumerate.Count, enumeratedItems.Count, "Count of enumerated items does not match.");
        }