public void SetXY_ForwardValue() { // Setup MockSerialDevice serialDevice = new MockSerialDevice("COM3", 9600); Wheelchair chair = Wheelchair.Instance(serialDevice); bool correctValues = true; int input = 100; int expectedOutput = 190; int actualOutput = -1; chair.Start(); // act chair.SetX(0); chair.SetY(input); System.Threading.Thread.Sleep(150); actualOutput = chair.VoltY; chair.End(); string message = "Expected: "; message += expectedOutput; message += ", Actual: "; message += actualOutput; chair.Dispose(); Assert.AreEqual(expectedOutput, actualOutput, message); }
public void Start_InvalidPortName_ShouldThrowArgumentException() { MockSerialDevice serialDevice = new MockSerialDevice("Con3", 9600); Wheelchair chair = Wheelchair.Instance(serialDevice); chair.Start(); chair.End(); chair.Dispose(); Assert.Fail("Invalid Port Name. Argument Exception was not thrown."); }
public void Start_InvalidComPort_ShouldThrowIOException() { MockSerialDevice serialDevice = new MockSerialDevice("COM7", 9600); Wheelchair chair = Wheelchair.Instance(serialDevice); chair.Start(); chair.End(); chair.Dispose(); Assert.Fail("Invalid COM Port. IO Exception was not thrown."); }
public void Start_PortInUse_ShouldThrowUnauthorizedEx() { // Setup MockSerialDevice serialDevice = new MockSerialDevice("COM5", 9600); Wheelchair chair = Wheelchair.Instance(serialDevice); chair.Start(); chair.End(); chair.Dispose(); Assert.Fail("Unauthorized Access Exception was not thrown."); }