예제 #1
0
        public void SetObjectThenMove_MovesWithinGrid()
        {
            var grid = new UniversalGrid <string>(10, 20);

            var thing1 = "A".AsSpatialObject(1, 1);

            var movedFired = false;

            grid.ItemMoved += (s, e) =>
            {
                movedFired = true;
            };

            grid.SetObject(thing1);

            Assert.That(grid.GetObjectsAt(1, 1).Single(), Is.SameAs(thing1));

            thing1.Move(0, 1);

            Assert.That(grid.GetObjectsAt(1, 1).Any(), Is.False);
            Assert.That(grid.GetObjectsAt(1, 2).Single(), Is.SameAs(thing1));
            Assert.That(movedFired);
        }