示例#1
0
        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);
        }
示例#2
0
        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);
        }