public void FlightSimulatorXException_Custom_Constructor_Initialises_Properties_Correctly() { var exception = new FlightSimulatorXException((uint)FlightSimulatorXExceptionCode.DataError, 12, 43); Assert.AreEqual(FlightSimulatorXExceptionCode.DataError, exception.ExceptionCode); Assert.AreEqual((uint)FlightSimulatorXExceptionCode.DataError, exception.RawExceptionCode); Assert.AreEqual(12u, exception.IndexNumber); Assert.AreEqual(43u, exception.SendID); }
public void FlightSimulatorXException_Custom_Constructor_Sets_Message_Based_On_Parameters() { var exception = new FlightSimulatorXException((uint)FlightSimulatorXExceptionCode.OutOfBounds, 2, 3); Assert.AreEqual("FSX exception OutOfBounds(31), parameter 2, packet 3", exception.Message); }
public void FlightSimulatorXException_Custom_Constructor_Copes_When_No_Enum_Exists_For_The_Exception_Code() { var exception = new FlightSimulatorXException(91237, 12, 43); Assert.AreEqual(FlightSimulatorXExceptionCode.Unknown, exception.ExceptionCode); Assert.AreEqual(91237u, exception.RawExceptionCode); }
public void FlightSimulatorXPresenter_Rethrows_FSX_Exceptions() { _Presenter.Initialise(_View.Object); var exception = new FlightSimulatorXException(); bool seenException = false; try { _FlightSimulatorX.Raise(f => f.FlightSimulatorXExceptionRaised += null, new EventArgs<FlightSimulatorXException>(exception)); } catch(Exception ex) { seenException = ex == exception; } Assert.IsTrue(seenException); }