IRobot implementation using the SCORBOT for operations.
Наследование: IRobot
Пример #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());
        }
Пример #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));
        }
Пример #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());
        }
Пример #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);
        }
Пример #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));
        }
Пример #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());
        }
Пример #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));
        }
Пример #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));
        }
Пример #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)));
        }
Пример #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));
        }
Пример #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));
        }
Пример #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());
        }
Пример #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());
        }