public async Task DisconnectAsync_ConnectionIsNotOpen_ConnectionIsNotClosed() { var connectionMock = new Mock <IOwiUsbConnection>(); connectionMock.SetupGet(mock => mock.IsOpen).Returns(false); var arm = new OwiArm(connectionMock.Object); await arm.DisconnectAsync(); connectionMock.Verify(mock => mock.CloseAsync(), Times.Never); }
public async Task DisconnectAsync_ConnectionIsOpen_CallsCloseOnUsbConnection() { var connectionMock = new Mock <IOwiUsbConnection>(); connectionMock.SetupGet(mock => mock.IsOpen).Returns(true); var arm = new OwiArm(connectionMock.Object); await arm.DisconnectAsync(); connectionMock.Verify(mock => mock.CloseAsync(), Times.Once); }