public void deploysBot()
        {
            Mission testMission = new Mission();
            testMission.processInstructionSet("../../TestInputs/goodBasic.txt");
            testMission.execute();

            Assert.IsTrue(testMission.bots[0].Deployed);
        }
        public void handlesBotCollision()
        {
            Mission testMission = new Mission();
            testMission.processInstructionSet("../../TestInputs/movementCollisions.txt");
            testMission.execute();

            Assert.AreEqual(1, testMission.bots[0].X);
            Assert.AreEqual(2, testMission.bots[1].X);
            Assert.AreEqual(-2, testMission.bots[2].X);
        }
        public void detectsOutOfBoundsDeployment()
        {
            Mission testMission = new Mission();
            testMission.processInstructionSet("../../TestInputs/outOfBoundsDeployment.txt");
            testMission.execute();

            Assert.IsFalse(testMission.bots[1].Deployed);
            Assert.IsFalse(testMission.bots[2].Deployed);
            Assert.IsFalse(testMission.bots[3].Deployed);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            try {
                if (args.Any()) {
                    if (File.Exists(args[0])) {
                        Mission mission = new Mission();

                        mission.processInstructionSet(args[0]);
                        mission.execute();
                        mission.reportPositions();
                    }
                    else {
                        throw new Exception("Input Error: File path not found.\n");
                    }
                }
                else {
                    throw new Exception("Input Error: You must provide the path of your instructions file.\n Usage: UnderWaterBots.exe <file>\n");
                }
            }
            catch (Exception e) {
                Console.WriteLine("{0}", e);
            }
        }
        public void performsBasicMovement()
        {
            Mission testMission = new Mission();
            testMission.processInstructionSet("../../TestInputs/goodBasic.txt");
            testMission.execute();

            Assert.AreEqual(0, testMission.bots[0].X);
            Assert.AreEqual(2, testMission.bots[0].Y);
            Assert.AreEqual('N', testMission.bots[0].Heading);
            Assert.AreEqual(2, testMission.bots[1].X);
            Assert.AreEqual(0, testMission.bots[1].Y);
            Assert.AreEqual('N', testMission.bots[1].Heading);
            Assert.AreEqual(0, testMission.bots[2].X);
            Assert.AreEqual(-2, testMission.bots[2].Y);
            Assert.AreEqual('W', testMission.bots[2].Heading);
            Assert.AreEqual(-2, testMission.bots[3].X);
            Assert.AreEqual(0, testMission.bots[3].Y);
            Assert.AreEqual('W', testMission.bots[3].Heading);
        }