*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Collections.Generic;
using System.Linq;
[Description("Tizen.System.Usb.UsbBulkEndpoint test class")]
public class UsbBulkEndpointTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported= true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "_isSupported:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if transfer on loopback is sent correctly")]
using System.Linq;
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System.Collections.Generic;
using System;
[Description("Tizen.System.Usb.UsbConfiguration test class")]
public class UsbConfigurationTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if SetAsActive method sets active configuration for device")]
using System;
using NUnit.Framework;
using System.Runtime.InteropServices;
+using NUnit.Framework.TUnit;
namespace Tizen.System.Usb.Tests
{
[Description("Tizen.System.Usb.UsbControlEndpoint test class")]
public class UsbControlEndpointTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if request for device descriptor returns valid descriptor")]
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Collections.Generic;
using System.Linq;
[Description("Tizen.System.Usb.UsbDevice test class")]
public class UsbDeviceTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Call Open method and check if device is in open state")]
public static void ActiveConfiguration_InvalidOperationException()
{
Helper.Check();
+
try
{
Helper.Check();
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Linq;
[Description("Tizen.System.Usb.UsbDeviceInformation test class")]
public class UsbDeviceInformationTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if UsbVersion property returns valid value")]
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Linq;
[Description("Tizen.System.Usb.UsbDeviceStrings test class")]
public class UsbDeviceStringsTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
+
private static DeviceStringsData GetTestData(UsbDevice testUsbDevice)
{
var info = testUsbDevice.DeviceInformation;
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Collections.Generic;
using System.Linq;
[Description("Tizen.System.Usb.UsbEndpoint test class")]
public class UsbEndpointTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if Id property returns valid value")]
[Description("Tizen.System.Usb.UsbInterface test class")]
public class UsbInterfaceTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Claim method should not throw any exception")]
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Collections.Generic;
using System.Linq;
[Description("Tizen.System.Usb.UsbInterruptEndpoint test class")]
public class UsbInterruptEndpointTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if transfer on loopback is sent correctly")]
*/
using NUnit.Framework;
+using NUnit.Framework.TUnit;
using System;
using System.Collections.Generic;
using System.Linq;
[Description("Tizen.System.Usb.UsbIsochronousEndpoint test class")]
public class UsbIsochronousEndpointTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
+
[Test]
[Category("P1")]
[Description("Test: Check if SynchronizationType property returns valid value")]
using System;
using NUnit.Framework;
+using NUnit.Framework.TUnit;
namespace Tizen.System.Usb.Tests
{
[Description("Tizen.System.Usb.UsbManager Class Tests")]
public class UsbManagerTests
{
+ [SetUp]
+ public static void Init()
+ {
+ bool ret_value;
+ bool value;
+
+ ret_value = Tizen.System.SystemInfo.TryGetValue<bool>("http://tizen.org/feature/usb.host", out value);
+ if (ret_value == true && value == true)
+ {
+ Helper._isSupported = true;
+ }
+ else
+ {
+ Helper._isSupported = false;
+ }
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "isSupport:" + Helper._isSupported);
+
+ try
+ {
+ Helper._manager = new UsbManager();
+ }
+ catch (NotSupportedException)
+ {
+ if (Helper._isSupported == false)
+ Assert.Pass("Usb host feature is false");
+ }
+ }
+
[Test]
[Category("P1")]
[Description("Test: Check if constructor returns valid UsbManager object without any failure or exception")]
{
internal static class Helper
{
- private static bool _isInitialized = false;
- private static bool _isSupported = false;
- private static UsbManager _manager = null;
+ public static bool _isSupported = false;
+ public static UsbManager _manager = null;
private static IEnumerable<DeviceData> _testData = new List<DeviceData>
{
}
};
- private static void Initialize()
- {
- _isInitialized = true;
- Information.TryGetValue("http://tizen.org/feature/usb.host", out _isSupported);
- if (_isSupported == false) return;
-
- try
- {
- _manager = new UsbManager();
- }
- catch (Exception e)
- {
- if (_isSupported == false)
- {
- Assert.IsTrue(e.GetType().Name.Equals("NotSupportedException"),
- $"Expecting: NotSupportedException, Actual: {e.GetType().Name}");
- }
- else
- {
- Assert.IsTrue(false, $"Unexpected Exception : {e.GetType().Name} -- {e.Message}");
- foreach(var line in Regex.Split(e.StackTrace, "\n")) Log(line);
- }
- }
- }
-
internal static bool IsUsbSupported
{
get
{
- if (_isInitialized == false) Initialize();
return _isSupported;
}
}
{
get
{
- if (_isInitialized == false) Initialize();
return _manager;
}
}