diff options
Diffstat (limited to 'tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs')
-rw-r--r-- | tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs b/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs new file mode 100644 index 0000000..de9e8b5 --- /dev/null +++ b/tct-mediacontent-tizen-tests/src/Testcase/TSContentManager.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TestFramework; +using Tizen.Content.MediaContent; +using System.IO; + +namespace TizenTest.MediaInformationT +{ + [TestFixture] + [Description("Tizen.Content.MediaContent.ContentManager Tests")] + class TSContentManager + { + private static string TAG = "TCT"; + private static string _logTag = "TizenTest.MediaInformationT.ContentManager"; + private static string _rootPath = "/home/owner/content/uts-media/"; + [SetUp] + public static void Init() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static void Destroy() + { + //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFile in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.Scan M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void scanFile_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager"); + string path = _rootPath + "test_scan.jpg"; + try + { + ContentManager.Scan(path); + }catch(Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager failed : "+ e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:scanFile_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P2")] + [Description("Test for ScanFile in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.Scan M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static void invalidScanFile_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:invalidScanFile_CHECK_RESULT ContentManager"); + string path = _rootPath +"/Unknown.jpg"; + try + { + ContentManager.Scan(path); + Assert.Fail(); + } + catch (Exception e) + { + Assert.Pass(); + } + Tizen.Log.Info(TAG, "Executing TC:invalidScanFile_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.ScanFolder M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task scanFolder_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:scanFolder_CHECK_RESULT ContentManager"); + string path = _rootPath +"test_scan_folder"; + try + { + await ContentManager.ScanFolderAsync(path); + } + catch (Exception) + { + LogUtils.write(LogUtils.ERROR, _logTag, "Failed to scan folder :" + path); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:scanFolder_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.AddMediaInformationBatchAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task insertBatch_CHECK_RESULT() + { + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager"); + //string path = "/home/owner/content/test_media_batch"; + string[] files = Directory.GetFiles(_rootPath + "batch", "*.png"); + + try + { + await ContentManager.AddMediaInformationBatchAsync(files); + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager failed : " + e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:insertBatch_CHECK_RESULT ContentManager end"); + } + + [Test] + [Category("P1")] + [Description("Test for ScanFolder in ContentManager ...")] + [Property("SPEC", " Tizen.Content.MediaContent.ContentManager.RemoveMediaInformationBatchAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")] + public static async Task removeBatch_CHECK_RESULT() + { + ContentFilter filter = new ContentFilter(); + filter.Condition = "MEDIA_PATH = " + _rootPath + "batch"; + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager"); + try + { + await ContentManager.RemoveMediaInformationBatchAsync(filter); + + } + catch (Exception e) + { + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager failed : "+ e.Message ); + Assert.Fail(); + } + Tizen.Log.Info(TAG, "Executing TC:removeBatch_CHECK_RESULT ContentManager end"); + } + } +} |