using NUnit.Framework.TUnit;
using System;
using System.Linq;
+using System.IO;
namespace Tizen.System.Usb.Tests
{
foreach (var testdata in Helper.GetDeviceTestData())
{
var deviceUnderTest = testdata.Key;
- var expectedTestData = testdata.Value;
// PRECONDITION
Assert.IsNotNull(deviceUnderTest, "Invalid USB Device for test");
- Assert.IsNotNull(expectedTestData, "Unable to fetch test data for USB device");
-
var testDeviceInfo = deviceUnderTest.DeviceInformation;
- var expectedDeviceInfo = expectedTestData.DeviceInformation;
+
+ byte[] desc = File.ReadAllBytes($"/dev/bus/usb/{deviceUnderTest.BusId:D3}/{deviceUnderTest.Address:D3}");
+ var expectedVersion = BitConverter.ToUInt16(desc, 2);
// TEST CODE
- Assert.IsTrue(expectedDeviceInfo.UsbVersion == testDeviceInfo.UsbVersion,
- $"Wrong UsbVersion, Expected: {expectedDeviceInfo.UsbVersion}, Actual: {testDeviceInfo.UsbVersion}");
+ Assert.IsTrue(expectedVersion == testDeviceInfo.UsbVersion,
+ $"Wrong UsbVersion, Expected: {expectedVersion}, Actual: {testDeviceInfo.UsbVersion}");
}
}
catch (NotSupportedException)