[Storage][TCSACR-222][Check ArgumentException] 76/199976/7
authorpr.jung <pr.jung@samsung.com>
Mon, 18 Feb 2019 04:34:01 +0000 (13:34 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 26 Feb 2019 05:27:53 +0000 (14:27 +0900)
Change-Id: If20ceba28d9ecae2e694e6801417c9b9f41c5352
Signed-off-by: pr.jung <pr.jung@samsung.com>
tct-suite-vs/Tizen.System.Manual.Tests/testcase/TSStorage.cs [changed mode: 0755->0644]
tct-suite-vs/Tizen.System.Manual.Tests/testcase/TSStorageManager.cs [changed mode: 0755->0644]
tct-suite-vs/Tizen.System.Tests/testcase/TSStorage.cs

old mode 100755 (executable)
new mode 100644 (file)
index e1a601f..dcad9a2
@@ -17,9 +17,18 @@ namespace Tizen.System.Tests
     [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]
@@ -42,18 +51,10 @@ namespace Tizen.System.Tests
         [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");
 
old mode 100755 (executable)
new mode 100644 (file)
index 9d2b6f4..2dc4f41
@@ -10,9 +10,18 @@ namespace Tizen.System.Manual.Tests.testcase
     [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]
@@ -36,18 +45,10 @@ namespace Tizen.System.Manual.Tests.testcase
         [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");
 
@@ -94,18 +95,10 @@ namespace Tizen.System.Manual.Tests.testcase
         [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");
 
index 9d8bc9f..1b1b1e6 100644 (file)
@@ -21,6 +21,7 @@ namespace Tizen.System.Tests
         static Storage internalStorage = null;
         static Storage externalStorage = null;
         static int internalStorageId = 0;
+        static bool support = true;
 
         static void Debug(string msg)
         {
@@ -37,6 +38,13 @@ namespace Tizen.System.Tests
         [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]
@@ -74,25 +82,44 @@ namespace Tizen.System.Tests
 
         [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.");
 
@@ -104,25 +131,12 @@ namespace Tizen.System.Tests
                 }
                 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");
             }
         }
 
@@ -312,18 +326,7 @@ namespace Tizen.System.Tests
         [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.");
 
@@ -334,13 +337,7 @@ namespace Tizen.System.Tests
             }
             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");
             }
         }