IRobot implementation using the SCORBOT for operations.
Inheritance: IRobot
Ejemplo n.º 1
0
        public void closeGripper_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.closeGripperWrapped()).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            robot.closeGripper();

            wp.AssertWasCalled(t => t.closeGripperWrapped());
        }
Ejemplo n.º 2
0
        public void getJawOpeningWidthPercentage_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.getJawWrapped(ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy, ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy)).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            robot.getJawOpeningWidthPercentage();

            wp.AssertWasCalled(t => t.getJawWrapped(ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy, ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy));
        }
Ejemplo n.º 3
0
        public void getJawOpeningWidthMilimeters_IsCalled_ReturnFalse_ExpectException()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(
                t =>
                t.getJawWrapped(ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy,
                                ref Arg<short>.Ref(Rhino.Mocks.Constraints.Is.Anything(), new short()).Dummy)).Return(
                                    false);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.Catch(() => robot.getJawOpeningWidthMilimeters());
        }
Ejemplo n.º 4
0
        public void Wrapper_PropertyTest()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.AreEqual(wp, robot.wrapper);
        }
Ejemplo n.º 5
0
        public void Time_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.timeWrapped(Arg<Wrapper.enumAxisSettings>.Is.Anything, Arg<int>.Is.Anything)).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.IsTrue(robot.Time(Wrapper.enumAxisSettings.AXIS_ALL, 1000));
        }
Ejemplo n.º 6
0
        public void stopAllMovement_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.stopWrapped(Arg<Wrapper.enumAxisSettings>.Is.Equal(Wrapper.enumAxisSettings.AXIS_ROBOT))).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            robot.Sem.WaitOne();
            Assert.IsTrue(robot.stopAllMovement());
        }
Ejemplo n.º 7
0
        public void moveWristRoll_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.moveManualWrapped(Arg<Wrapper.enumManualModeWhat>.Is.Equal(Wrapper.enumManualModeWhat.MANUAL_MOVE_WRISTROLL), Arg<int>.Is.Equal(100))).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.IsTrue(robot.moveWristRoll(100));
        }
Ejemplo n.º 8
0
        public void moveByZCoordinate_IsCalled_ReturnFalse()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.moveManualWrapped(Arg<Wrapper.enumManualModeWhat>.Is.Equal(Wrapper.enumManualModeWhat.MANUAL_MOVE_Z), Arg<int>.Is.Equal(10))).Return(false);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.IsFalse(robot.moveByZCoordinate(10));
        }
Ejemplo n.º 9
0
        public void moveByPitch_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.moveManualWrapped(Arg<Wrapper.enumManualModeWhat>.Is.Equal(Wrapper.enumManualModeWhat.MANUAL_MOVE_PITCH), Arg<int>.Is.Equal(10))).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;
            robot.homeRobot();

            robot.moveByPitch(10);

            wp.AssertWasCalled(t => t.moveManualWrapped(Arg<Wrapper.enumManualModeWhat>.Is.Equal(Wrapper.enumManualModeWhat.MANUAL_MOVE_PITCH), Arg<int>.Is.Equal(10)));
        }
Ejemplo n.º 10
0
        public void movebyCoordinates_IsCalled_ReturnTrue()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();
            wp.Stub(t => t.moveManualWrapped(Arg<Wrapper.enumManualModeWhat>.Is.Anything, Arg<int>.Is.Anything)).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            //Assert.IsTrue(robot.movebyCoordinates(10, 20, 30));
        }
Ejemplo n.º 11
0
        public void movebyCoordinates_IsCalled_ReturnFalseOnMoveZ()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.moveManualWrapped(Wrapper.enumManualModeWhat.MANUAL_MOVE_X, 10)).Return(true);
            wp.Stub(t => t.moveManualWrapped(Wrapper.enumManualModeWhat.MANUAL_MOVE_Y, 20)).Return(true);
            wp.Stub(t => t.moveManualWrapped(Wrapper.enumManualModeWhat.MANUAL_MOVE_Z, 30)).Return(false);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            //Assert.IsFalse(robot.movebyCoordinates(10, 20, 30));
        }
Ejemplo n.º 12
0
        public void isOnline_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None, 8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.isOnlineOkWrapped()).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.IsTrue(robot.isOnline());
        }
Ejemplo n.º 13
0
        public void HomeRobot_IsCalled()
        {
            IWrapper wp = MockRepository.GenerateStub<IWrapper>();
            SerialSTK serialSTK = MockRepository.GenerateStub<SerialSTK>(9600, Parity.None,8, StopBits.One);
            Robot robot = new Robot();

            wp.Stub(t => t.homeWrapped(Arg<Wrapper.enumAxisSettings>.Is.Equal(Wrapper.enumAxisSettings.AXIS_ROBOT), Arg<DLL.DgateCallBackByteRefArg>.Is.Anything)).Return(true);

            robot.wrapper = wp;
            robot.STK = serialSTK;

            Assert.IsTrue(robot.homeRobot());
        }