public void Successful_Scenario_Test() { SetupWrite(ftdiMock, new byte[] { 0xca }, new byte[] { 0x2c }); SetupRead(ftdiMock, new byte[] { 0xca }, new byte[] { 0x00 }); var sut = new CancelCalibrationCommand(); var result = sut.Execute(ftdiMock.Object); result.Success.Should().BeTrue(); }
public void Exception_Test(byte errorCode, Type ex) { SetupWrite(ftdiMock, new byte[] { 0xca }, new byte[] { 0x2c }); SetupRead(ftdiMock, new byte[] { 0xca }, new byte[] { errorCode }); var sut = new CancelCalibrationCommand(); Action act = () => sut.Execute(ftdiMock.Object); TestDelegate test = new TestDelegate(act); MethodInfo method = typeof(Assert).GetMethod("Throws", new[] { typeof(TestDelegate) }); MethodInfo generic = method.MakeGenericMethod(ex); generic.Invoke(this, new object[] { test }); }