示例#1
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void changeHeadingMultiple()
        {
            //Arrange
            IGarden testGarden = new Garden();
            Mower testMower = new Mower(testGarden);

            //Act
            testMower.move("LLRRR");

            //Assert
            Assert.AreEqual('E', testMower.Heading);
        }
示例#2
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void changeHeading()
        {
            //Arrange
            IGarden testGarden = new Garden();
            Mower testMower = new Mower(testGarden);

            //Act
            testMower.move('L');

            //Assert
            Assert.AreEqual('W', testMower.Heading);
        }
示例#3
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void moveSingle()
        {
            //Arrange
            IGarden testGarden = new Garden {Width=1, Length=1 };
            Mower testMower = new Mower(testGarden);

            //Act
            testMower.move('M');

            //Assert
            Assert.AreEqual(0, testMower.Position.X);
            Assert.AreEqual(1, testMower.Position.Y);
        }
示例#4
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void moveMultiple2()
        {
            //Arrange
            IGarden testGarden = new Garden { Width = 5, Length = 5 };
            Mower testMower = new Mower(testGarden, new CoOrdinate { X = 3, Y = 3 }, 'E');

            //Act
            testMower.move("MMRMMRMRRM");

            //Assert
            Assert.AreEqual('E', testMower.Heading);
            Assert.AreEqual(5, testMower.Position.X);
            Assert.AreEqual(1, testMower.Position.Y);
        }
示例#5
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void moveMultiple()
        {
            //Arrange
            IGarden testGarden = new Garden { Width = 5, Length = 5 };
            Mower testMower = new Mower(testGarden, new CoOrdinate {X=1, Y=2 }, 'N');

            //Act
            testMower.move("LMLMLMLMM");

            //Assert
            Assert.AreEqual('N', testMower.Heading);
            Assert.AreEqual(1, testMower.Position.X);
            Assert.AreEqual(3, testMower.Position.Y);
        }
示例#6
0
文件: MowerTest.cs 项目: burrowsj/PC
        public void moveException()
        {
            //Arrange
            IGarden testGarden = new Garden { Width = 1, Length = 1 };
            Mower testMower = new Mower(testGarden, new CoOrdinate { X = 0, Y = 0 }, 'W');
            string message = string.Empty;
            //Act
            try {
                testMower.move('M');
            }
            catch(Exception ex)
            {
                message = ex.Message;
            }

            //Assert
            Assert.AreEqual(0, testMower.Position.X);
            Assert.AreEqual(0, testMower.Position.Y);
            Assert.AreEqual("You have reached the edge of the garden", message);
        }