Beispiel #1
0
        public void WriteOpenExceptionTest()
        {
            var stubHelper = new StubNativeHelper();
            var stubInfo   = new StubDeviceInfo($"{nameof(WriteOpenExceptionTest)}", 1, 1);
            var mock       = new MockHidDevice(stubInfo, stubHelper);

            stubHelper.IsThrow = true;
            Assert.Catch <DeviceCouldNotOpenedException>(() => mock.WriteOpen());
        }
Beispiel #2
0
        public void WriteOpenTest()
        {
            var stubHelper = new StubNativeHelper();
            var stubInfo   = new StubDeviceInfo($"{nameof(WriteOpenTest)}", 1, 1);
            var mock       = new MockHidDevice(stubInfo, stubHelper);

            mock.WriteOpen().IsTrue();
            mock.IsWriteOpened.IsTrue();
        }
Beispiel #3
0
        public void WriteOpenFailureTest()
        {
            var stubHelper = new StubNativeHelper();
            var stubInfo   = new StubDeviceInfo($"{nameof(WriteOpenFailureTest)}", 1, 1);
            var mock       = new MockHidDevice(stubInfo, stubHelper);

            stubHelper.IsFailureHandle = true;
            mock.WriteOpen().IsFalse();
            mock.IsWriteOpened.IsFalse();
        }