예제 #1
0
        public void GoingOffTheGridToTheTopWrapsToTheBottom()
        {
            var grid = Substitute.For<IGrid>();
            var navigator = new Navigator(grid);
            grid.Width.Returns(5);
            grid.Height.Returns(5);

            var pos = navigator.Wrap(new Position(2, 5));

            Assert.Equal(new Position(2, 0), pos);
        }
예제 #2
0
        public void GoingOffTheGridToTheRightWrapsToTheLeft()
        {
            var grid = Substitute.For<IGrid>();
            var navigator = new Navigator(grid);
            grid.Width.Returns(5);
            grid.Height.Returns(5);

            var pos = navigator.Wrap(new Position(6, 2));

            Assert.Equal(new Position(1, 2), pos);
        }