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()); }
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)); }
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()); }
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); }
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)); }
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()); }
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)); }
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)); }
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))); }
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)); }
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)); }
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()); }
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()); }