Esempio n. 1
0
        public void Setup()
        {
            var testData = new[]
            {
                "F10", "N3", "F7", "R90", "F11"
            };

            var mockPuzzleInput = new Mock <IPuzzleInput>();

            mockPuzzleInput.Setup(p => p.GetPuzzleInputAsArray(It.IsAny <string>())).Returns(testData);

            _navigator = new WaypointNavigator(mockPuzzleInput.Object);

            var i = 0;

            // F10
            _navigator.ExecuteAction(testData[i]);
            Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(100, 10)));
            Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 1)));
            i++;

            // N3
            _navigator.ExecuteAction(testData[i]);
            Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(100, 10)));
            Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 4)));
            i++;

            // F7
            _navigator.ExecuteAction(testData[i]);
            Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(170, 38)));
            Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(10, 4)));
            i++;

            // R90
            _navigator.ExecuteAction(testData[i]);
            Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(170, 38)));
            Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(4, -10)));
            i++;

            // F11
            _navigator.ExecuteAction(testData[i]);
            Assume.That(_navigator.CurrentPosition, Is.EqualTo(new Point(214, -72)));
            Assume.That(_navigator.Waypoint, Is.EqualTo(new Point(4, -10)));
        }
Esempio n. 2
0
        public void Setup()
        {
            var testData = new[]
            {
                _input
            };

            var mockPuzzleInput = new Mock <IPuzzleInput>();

            mockPuzzleInput.Setup(p => p.GetPuzzleInputAsArray(It.IsAny <string>())).Returns(testData);

            _navigator = new WaypointNavigator(mockPuzzleInput.Object);

            _navigator.ExecuteAction(_input);
        }