Class that encapsulates controlling manual movement. Instead of using directly Robot or Simulator by interface. Note: Uses IRobot, so it is able to use either a Robot or a Simulator.
Inheritance: IManualController
        public void ManualController_CallsIt_SpeedIsSetTo50()
        {
            // Setup and test
            mcTestObj = new ManualController();
            mcTestObj.Speed = 50;

            // Verify
            Assert.AreEqual(50, mcTestObj.Speed);
        }
        public void ManualController_DefaultConstructorCalledWhenNoConnection_ThrowsExceptionIfOffline()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateStub<IRobot>();
            irMock.Stub(t => t.isOnline()).Return(false);

            // Test
            Factory.currentIRobotInstance = irMock;
            mcTestObj = new ManualController();
        }
        public void ManualControl_SetsIt_GetsSaved()
        {
            // Setup
            vmmsTestObj = new ViewModelManualSteering();
            ManualController mcTmp = new ManualController();

            // Test
            vmmsTestObj.ManualControl = mcTmp;

            // Verify
            Assert.AreSame(mcTmp, vmmsTestObj.ManualControl);
        }
        public void ManualController_DefaultConstructorCalled_RobotConnectionIsSameAsFactorycurrentIRobotInstance()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateStub<IRobot>();
            irMock.Stub(t => t.isOnline()).Return(true);

            // Test
            Factory.currentIRobotInstance = irMock;
            mcTestObj = new ManualController();

            // Verify
            Assert.IsTrue(mcTestObj.RobotConnection == Factory.currentIRobotInstance);
        }
        public void ManualController_DefaultConstructorCalled_ChecksForBeingOnline()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            irMock.Stub(t => t.isOnline()).Return(true);

            // Test
            Factory.currentIRobotInstance = irMock;
            mcTestObj = new ManualController();

            // Verify
            irMock.AssertWasCalled(t => t.isOnline());
        }
        public void moveCoordZ_CalledWithArgIncreasing_CallsRobotmoveByZCoordinateWithPositiveSpeedValue()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            mcTestObj.Speed = 50;
            irMock.Stub(t => t.moveByZCoordinate(Arg<int>.Is.Anything)).Return(true);

            // Test
            mcTestObj.moveCoordZ(enumIncDec.MANUAL_MOVE_INC);

            // Verify
            irMock.AssertWasCalled(t => t.moveByZCoordinate(mcTestObj.Speed));
        }
        public void moveCoordY_CalledWithArgDecreasing_CallsRobotmoveByYCoordinate()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.moveByYCoordinate(Arg<int>.Is.Anything)).Return(true);

            // Test
            mcTestObj.moveCoordY(enumIncDec.MANUAL_MOVE_DEC);

            // Verify
            irMock.AssertWasCalled(t => t.moveByYCoordinate(Arg<int>.Is.Anything));
        }
        public void moveCoordRoll_CalledWithArgDecreasing_CallsRobotmoveByRollWithPositiveSpeedValue_ReturnFalse_ExpectException()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            mcTestObj.Speed = 50;
            irMock.Stub(t => t.moveByRoll(Arg<int>.Is.Anything)).Return(false);

            // Test
            Assert.Catch(() => mcTestObj.moveCoordRoll(enumIncDec.MANUAL_MOVE_DEC));
        }
        public void Speed_SettingSpeedTo50_SpeedIsSaved()
        {
            // Setup
            mcTestObj = new ManualController();

            // Test
            mcTestObj.Speed = 50;

            // Verify
            Assert.AreEqual(mcTestObj.Speed, 50);
        }
        public void setTimeSecond_Checking_ForBeingCalled()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.Time(Arg<Wrapper.enumAxisSettings>.Is.Anything, Arg<long>.Is.Anything)).Return(true);

            // Test
            mcTestObj.setTimeSecond(200);

            // Verify
            irMock.AssertWasCalled(t => t.Time(Arg<Wrapper.enumAxisSettings>.Is.Anything, Arg<long>.Is.Anything));
        }
        public void moveAxisPitch_ReturnsFalse_CastExceptions()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.moveWristPitch(Arg<int>.Is.Anything)).Return(false);

            // Verify
            Assert.Catch(() => mcTestObj.moveAxisPitch(enumUpDown.MANUAL_MOVE_UP));
        }
        public void moveAxisPitch_CalledWithArgUp_CallsRobotmoveWristPitchWithPositiveSpeedValue()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            mcTestObj.Speed = 50;
            irMock.Stub(t => t.moveWristPitch(Arg<int>.Is.Anything)).Return(true);

            // Test
            mcTestObj.moveAxisPitch(enumUpDown.MANUAL_MOVE_UP);

            // Verify
            irMock.AssertWasCalled(t => t.moveWristPitch(mcTestObj.Speed));
        }
        public void moveAxisGripper_ReturnsFalseOnCloseGripper_CastExceptions()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.closeGripper()).Return(false);

            // Verify
            Assert.Catch(() => mcTestObj.moveAxisGripper(enumCloseOpen.MANUAL_CLOSE));
        }
        public void moveAxisGripper_CalledWithArgOpen_CallsRobotopenGripper()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.openGripper()).Return(true);

            // Test
            mcTestObj.moveAxisGripper(enumCloseOpen.MANUAL_OPEN);

            // Verify
            irMock.AssertWasCalled(t => t.openGripper());
        }
        public void stopAllMovement_CheckForWasCalled()
        {
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.stopAllMovement()).Return(true);

            mcTestObj.stopAllMovement();

            irMock.AssertWasCalled(t => t.stopAllMovement());
        }
        public void moveCoordZ_CalledWithArgIncreasing_CallsRobotmoveByZCoordinate_ReturnFalse_ExpectException()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.moveByZCoordinate(Arg<int>.Is.Anything)).Return(false);

            // Test
            Assert.Catch(() => mcTestObj.moveCoordZ(enumIncDec.MANUAL_MOVE_INC));
        }
        public void moveAxisBase_CalledWithArgLeft_CallsRobotmoveBase()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.moveBase(Arg<int>.Is.Anything)).Return(true);

            // Test
            mcTestObj.moveAxisBase(enumLeftRight.MANUAL_MOVE_LEFT);

            // Verify
            irMock.AssertWasCalled(t => t.moveBase(Arg<int>.Is.Anything));
        }
        public void moveAxisShoulder_CalledWithArgRight_CallsRobotmoveShoulderWithPositiveSpeedValue()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            mcTestObj.Speed = 50;
            irMock.Stub(t => t.moveShoulder(Arg<int>.Is.Anything)).Return(true);

            // Test
            mcTestObj.moveAxisShoulder(enumLeftRight.MANUAL_MOVE_RIGHT);

            // Verify
            irMock.AssertWasCalled(t => t.moveShoulder(mcTestObj.Speed));
        }
        public void moveAxisShoulder_ReturnsFalse_CastExceptions()
        {
            // Setup
            IRobot irMock = MockRepository.GenerateMock<IRobot>();
            mcTestObj = new ManualController();
            mcTestObj.RobotConnection = irMock;
            irMock.Stub(t => t.moveShoulder(Arg<int>.Is.Anything)).Return(false);

            // Verify
            Assert.Catch(() => mcTestObj.moveAxisShoulder(enumLeftRight.MANUAL_MOVE_LEFT));
        }
        public void Speed_SettingSpeedTo101_SpeedIsNotSaved()
        {
            // Setup
            mcTestObj = new ManualController();

            // Test
            mcTestObj.Speed = 101;

            // Verify
            Assert.AreNotEqual(mcTestObj.Speed, 101);
        }