Exemplo n.º 1
0
        public void TheLocationValue_ResetsAtBoundary()
        {
            var locationService = new LocationService();

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

            Assert.That(Location.Start, Is.EqualTo(oneOverBoundary));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 3
0
        public void NegativeValues_AreForbidden_WhenAdvancing(int invalidOffset)
        {
            var locationService = new LocationService();

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