Пример #1
0
        public static void ClassInitialize(TestContext testContext)
        {
            var converter = new ConverterPointOrientation();

            _moverForward = new MoverForward(converter);
            _field        = new Field {
                East = 2, North = 2, South = 2, West = 2
            };
        }
 public Tractor(
     Field field,
     IMoverForward moverForward,
     ITurnerClockwise turnerClockwise,
     ConverterPointOrientation converter)
     : base(field)
 {
     _moverForward    = moverForward;
     _turnerClockwise = turnerClockwise;
     _converter       = converter;
 }
        public void ConverterOrientationToPoint()
        {
            var converter = new ConverterPointOrientation();

            var direction = converter.OrientationToPoint(Orientation.West);

            Assert.AreEqual(new Point(-1, 0), direction);

            direction = converter.OrientationToPoint(Orientation.South);
            Assert.AreEqual(new Point(0, -1), direction);

            direction = converter.OrientationToPoint(Orientation.East);
            Assert.AreEqual(new Point(1, 0), direction);

            direction = converter.OrientationToPoint(Orientation.North);
            Assert.AreEqual(new Point(0, 1), direction);
        }
        public void ConverterPointToOrientation()
        {
            var converter = new ConverterPointOrientation();

            var orientation = converter.PointToOrientation(new Point(-1, 0));

            Assert.AreEqual(Orientation.West, orientation);

            orientation = converter.PointToOrientation(new Point(0, -1));
            Assert.AreEqual(Orientation.South, orientation);

            orientation = converter.PointToOrientation(new Point(1, 0));
            Assert.AreEqual(Orientation.East, orientation);

            orientation = converter.PointToOrientation(new Point(0, 1));
            Assert.AreEqual(Orientation.North, orientation);
        }
Пример #5
0
 public MoverForward(ConverterPointOrientation converter)
 {
     _converter = converter;
 }