コード例 #1
0
        public void NoMovement()
        {
            const int distanceMillimetres = 0;

            "When a robot is issued a command with no movement distance"
            .x(() => TestInstance.Move(distanceMillimetres));

            "Then the robot does not move"
            .x(() => GetDependency <IConsoleAdapter>().Verify(m => m.WriteLine(It.IsAny <string>(), It.IsAny <object>()), Times.Never()));
        }
コード例 #2
0
        public void MoveBackwards(int backwardDistance)
        {
            var distanceMillimetres = Faker.Random.Int(-1000, -1);

            $"Given a movement distance of {distanceMillimetres} mm"
            .x(() => backwardDistance = distanceMillimetres);

            "When a robot is issued a command to move"
            .x(() => TestInstance.Move(backwardDistance));

            "Then the robot moves backwards"
            .x(() => GetDependency <IConsoleAdapter>().Verify(m => m.WriteLine("Robot moved backwards {0}mm.", -backwardDistance), Times.Once()));
        }