Example #1
0
        public void RotateHeadToTheRightDenyBecauseDirectionRightIsLimitedTest()
        {
            //Arrange
            creator = new MockCreatorRobot();
            MockRobot robot = ((MockRobot)creator
                               .MakeARobot())
                              .WithHeadDirectionToRightIsLimited();

            //Action
            var result = robot.RotateHeadToTheRight();

            //Assert
            result.IsFailure.ShouldBeTrue();
            result.Failure.ShouldBeOfType <LimitedHeadRotateException>();
            robot.HeadDirection.ShouldBe(-90);
        }
Example #2
0
        public void RotateHeadToTheRightDenyBecauseAlignIsBottonTest()
        {
            //Arrange
            creator = new MockCreatorRobot();
            MockRobot robot = ((MockRobot)creator
                               .MakeARobot())
                              .WithHeadToBelow();

            //Action
            var result = robot.RotateHeadToTheRight();

            //Assert
            result.IsFailure.ShouldBeTrue();
            result.Failure.ShouldBeOfType <DeniedHeadRotateException>();
            robot.HeadDirection.ShouldBe(0);
            robot.RaisedEvents().ShouldHaveSingleItem();
        }