From 7168ea6d473f79423929390df49c14edbd2ff151 Mon Sep 17 00:00:00 2001 From: Yoshinori Ozaki Date: Tue, 6 Mar 2018 07:57:16 +0900 Subject: [PATCH] Minor changes in inspection and unit test. --- UsbInfo/UsbInfo.Tests/UsbInfoTest.cs | 7 +++++++ UsbInfo/UsbInfo/Interfaces/UsbSupportSpeed.cs | 6 +++++- UsbInfo/UsbInfo/Natives/NativeMethods.cs | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/UsbInfo/UsbInfo.Tests/UsbInfoTest.cs b/UsbInfo/UsbInfo.Tests/UsbInfoTest.cs index 596ccb7..b9c2a55 100644 --- a/UsbInfo/UsbInfo.Tests/UsbInfoTest.cs +++ b/UsbInfo/UsbInfo.Tests/UsbInfoTest.cs @@ -48,6 +48,13 @@ public void TestRootHub() Assert.NotEmpty(usbDevices); } + [Fact] + public void TestDeviceFromVid() + { + var usbDevices = UsbInfo.Devices(0x8087); + Assert.NotEmpty(usbDevices); + } + [Fact] public void TestDeviceFromVidPid() { diff --git a/UsbInfo/UsbInfo/Interfaces/UsbSupportSpeed.cs b/UsbInfo/UsbInfo/Interfaces/UsbSupportSpeed.cs index 4b16edd..5d8814b 100644 --- a/UsbInfo/UsbInfo/Interfaces/UsbSupportSpeed.cs +++ b/UsbInfo/UsbInfo/Interfaces/UsbSupportSpeed.cs @@ -1,6 +1,10 @@ -namespace UsbInfo.Interfaces +using JetBrains.Annotations; + +namespace UsbInfo.Interfaces { + [UsedImplicitly(ImplicitUseTargetFlags.Members)] public enum UsbSupportSpeed + { LowSpeed = 0, FullSpeed, diff --git a/UsbInfo/UsbInfo/Natives/NativeMethods.cs b/UsbInfo/UsbInfo/Natives/NativeMethods.cs index 0ee8f68..1c6d5d1 100644 --- a/UsbInfo/UsbInfo/Natives/NativeMethods.cs +++ b/UsbInfo/UsbInfo/Natives/NativeMethods.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; +using JetBrains.Annotations; using Microsoft.Win32.SafeHandles; using UsbInfo.Natives.Types; @@ -164,7 +165,7 @@ ref int RequiredSize [DllImport("setupapi.dll")] internal static extern PnpConfigrationResult CM_Get_Device_ID_Size(out int pulLen, uint dnDevInst, int uflags = 0); - + [AssertionMethod] internal static void ThrowIfSetLastError(bool result) { if (!result)