[Description("Tizen.System.Storage test class")]
public class StorageTests
{
+ static bool support = true;
+
[SetUp]
public void Init()
{
+ bool ret;
+ bool value;
+ ret = Information.TryGetValue<bool>("http://tizen.org/feature/storage.external", out value);
+ if (ret && value)
+ support = true;
+ else
+ support = false;
}
[TearDown]
[Step(4, "If you do not get \"pass\", please press fail.")]
public async Task StorageStateChanged_CHECK_SDCARD_EVENT()
{
- string profile;
- bool is_mobile;
// PRECONDITION
var storages = StorageManager.Storages.Where(s => s.StorageType == StorageArea.External).Select(s => s).ToList();
- Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
- if (String.Compare(profile, "mobile", true) == 0)
- is_mobile = true;
- else
- is_mobile = false;
-
- if (is_mobile)
+ if (support)
{
Assert.IsNotEmpty(storages, "SD card is not inserted");
[Description("Tizen.System.StorageManager test class")]
class StorageManagerTests
{
+ static bool support = true;
+
[SetUp]
public void Init()
{
+ bool ret;
+ bool value;
+ ret = Information.TryGetValue<bool>("http://tizen.org/feature/storage.external", out value);
+ if (ret && value)
+ support = true;
+ else
+ support = false;
}
[TearDown]
[Step(4, "If you don't get \"pass\", please press fail.")]
public async Task SetChangedEvent_CHECK_SDCARD_EVENT()
{
- string profile;
- bool is_mobile;
// PRECONDITION
var storages = StorageManager.Storages.Where(s => s.StorageType == StorageArea.External).Select(s => s).ToList();
- Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
- if (String.Compare(profile, "mobile", true) == 0)
- is_mobile = true;
- else
- is_mobile = false;
-
- if (is_mobile)
+ if (support)
{
Assert.IsEmpty(storages, "SD Card is inserted already");
[Step(4, "If you don't get \"pass\", please press fail.")]
public async Task UnsetChangedEvent_CHECK_SDCARD_EVENT()
{
- string profile;
- bool is_mobile;
// PRECONDITION
var storages = StorageManager.Storages.Where(s => s.StorageType == StorageArea.External).Select(s => s).ToList();
- Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
- if (String.Compare(profile, "mobile", true) == 0)
- is_mobile = true;
- else
- is_mobile = false;
-
- if (is_mobile)
+ if (support)
{
Assert.IsEmpty(storages, "SD Card is inserted already");
static Storage internalStorage = null;
static Storage externalStorage = null;
static int internalStorageId = 0;
+ static bool support = true;
static void Debug(string msg)
{
[SetUp]
public void Init()
{
+ bool ret;
+ bool value;
+ ret = Information.TryGetValue<bool>("http://tizen.org/feature/storage.external", out value);
+ if (ret && value)
+ support = true;
+ else
+ support = false;
}
[TearDown]
[Test]
[Category("P2")]
- [Description("Check if GetAbsolutePath() raises exception for ringtone directory")]
+ [Description("Check if GetAbsolutePath() raises not supported exception for external storage")]
[Property("SPEC", "Tizen.System.Storage.GetAbsolutePath M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
[Property("AUTHOR", "Dinesh Dwivedi, dinesh.d@samsung.com")]
public void GetAbsolutePath_CHECK_NOT_SUPPORTED_EXCEPTION()
{
- string profile;
- bool is_mobile;
-
- // PRECONDITION
- // 1. Device must have external storage (SD Card) installed.
- Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
- if (String.Compare(profile, "mobile", true) == 0)
- is_mobile = true;
+ if (support)
+ {
+ Assert.Pass("Test skipped! Can't test not supported exception");
+ }
else
- is_mobile = false;
+ {
+ if (externalStorage != null)
+ {
+ try
+ {
+ externalStorage.GetAbsolutePath(DirectoryType.Camera);
+ Assert.IsTrue(false, "This operation should raise NotSupportedException");
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");
+ }
+ }
+ }
+ }
- if (is_mobile)
+ [Test]
+ [Category("P2")]
+ [Description("Check if GetAbsolutePath() raises exception for ringtone directory")]
+ [Property("SPEC", "Tizen.System.Storage.GetAbsolutePath M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Dinesh Dwivedi, dinesh.d@samsung.com")]
+ public void GetAbsolutePath_CHECK_ARGUMENT_EXCEPTION()
+ {
+ if (support)
{
Assert.IsNotNull(externalStorage, "PRECONDITION: Failed to get external storage for testing.");
}
catch (Exception ex)
{
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "this operation should raise NotSupportedException exception");
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");
}
}
else
{
- if (externalStorage != null)
- {
- try
- {
- externalStorage.GetAbsolutePath(DirectoryType.Ringtones);
- Assert.IsTrue(false, "this operation should raise NotSupportedException exception");
- }
- catch (Exception ex)
- {
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "this operation should raise NotSupportedException exception");
- }
- }
- else // Can not connect usb on TV emulator
- Assert.Pass("Test skipped! The external storage is Not available");
+ Assert.Pass("Test skipped! The external storage is Not available");
}
}
[Property("AUTHOR", "Dinesh Dwivedi, dinesh.d@samsung.com")]
public void StorageType_GET_ENUM_STORAGEAREA_EXTERNAL()
{
- string profile;
- bool is_mobile;
-
- // PRECONDITION
- // 1. Device must have external storage (SD Card) installed.
- Information.TryGetValue<string>("tizen.org/feature/profile", out profile);
- if (String.Compare(profile, "mobile", true) == 0)
- is_mobile = true;
- else
- is_mobile = false;
-
- if (is_mobile)
+ if (support)
{
Assert.IsNotNull(externalStorage, "PRECONDITION: Failed to get external storage for testing.");
}
else
{
- if (externalStorage != null)
- {
- var result = externalStorage.StorageType;
- Assert.IsTrue(StorageArea.External == result, "Wrong external storage type");
- }
- else // Can not connect usb on TV emulator
- Assert.Pass("Test skipped! The external storage is Not available");
+ Assert.Pass("Test skipped! The external storage is Not available");
}
}