Ejemplo n.º 1
0
        public void MoveProbe()
        {
            var CC = container.GetInstance <ICommandCenter>();

            var probe = new Probe {
                CurrentPosition = new Position {
                    Direction = Direction.North, X = 1, Y = 2
                }
            };
            var probeTwo = new Probe {
                CurrentPosition = new Position {
                    Direction = Direction.East, X = 3, Y = 3
                }
            };
            var CurrentProbes = new List <Probe>()
            {
                probe, probeTwo
            };

            CCmock.Setup(q => q.GetCurrentProbes()).Returns(() => CurrentProbes);

            probe.AddCommands("LMLMLMLMM");
            probeTwo.AddCommands("MMRMMRMRRM");

            var current = true;

            while (current)
            {
                current = CC.MoveProbes();
            }

            Assert.True(probe.CurrentPosition.X == 1);
            Assert.True(probe.CurrentPosition.Y == 3);
            Assert.True(probe.CurrentPosition.Direction == Direction.North);

            Assert.True(probeTwo.CurrentPosition.X == 5);
            Assert.True(probeTwo.CurrentPosition.Y == 1);
            Assert.True(probeTwo.CurrentPosition.Direction == Direction.East);
        }