예제 #1
0
        public void TheLocationValue_ResetsAtBoundary()
        {
            var locationService = new LocationService();

            var oneOverBoundary = locationService.AdvanceBy(Location.Start, 12);

            Assert.That(Location.Start, Is.EqualTo(oneOverBoundary));
        }
예제 #2
0
        public void GivenValidOffset_WhenAdvancing_FinalPosition_IsSumModuloTwelve(int initialPosition, int offset)
        {
            var locationService = new LocationService();
            var initialLocation = new Location(initialPosition);

            var finalPosition = locationService.AdvanceBy(initialLocation, offset);

            Assert.That(finalPosition, Is.EqualTo(new Location((initialPosition + offset) % 12)));
        }
예제 #3
0
        public void NegativeValues_AreForbidden_WhenAdvancing(int invalidOffset)
        {
            var locationService = new LocationService();

            Assert.Throws <ArgumentException>(
                () =>
            {
                var x = locationService.AdvanceBy(Location.Start, invalidOffset);
            });
        }