1eb142226a3bb312ed2050053129a437f781d5f8
[platform/core/csapi/media-content.git] / tct-mediacontent-tizen-tests / src / Testcase / TSGroup.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Threading.Tasks;
4 using TestFramework;
5 using Tizen.Content.MediaContent;
6 namespace TizenTest.MediaInformationT
7 {
8     [TestFixture]
9     [Description("Tizen.Content.MediaContent.Group Tests")]
10     class TSGroup
11     {
12         [SetUp]
13         public static void Init()
14         {
15             //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
16         }
17
18         [TearDown]
19         public static void Destroy()
20         {
21             //LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
22         }
23
24         [Test]
25         [Category("P1")]
26         [Description("Test for Group count ...")]
27         [Property("SPEC", " Tizen.Content.MediaContent.Group M")]
28         [Property("SPEC_URL", "-")]
29         [Property("CRITERIA", "MR")]
30         [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
31         public static void groupCount_CHECK_RESULT()
32         {
33             ContentFilter filter = new ContentFilter();
34             filter.GroupType = MediaGroupType.DisplayName;
35             int Count  = ContentManager.Database.GetCount<Group>(filter);
36             Assert.IsTrue(Count > 0, "Failed to get the group Count");
37         }
38
39         [Test]
40         [Category("P1")]
41         [Description("Test for Group list ...")]
42         [Property("SPEC", " Tizen.Content.MediaContent.Group.Nanme A")]
43         [Property("SPEC_URL", "-")]
44         [Property("CRITERIA", "P")]
45         [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
46         public static async Task groupList_CHECK_RESULT()
47         {
48             ContentFilter filter = new ContentFilter();
49             filter.GroupType = MediaGroupType.DisplayName;
50             Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter);
51             await groupListTask;
52             IEnumerable<Group> groups = groupListTask.Result;
53             foreach( Group group in groups)
54             {
55                 Assert.IsTrue(group.Name.Length > 0, "Failed to get the group information");
56             }
57         }
58
59         [Test]
60         [Category("P1")]
61         [Description("Test for MediaInformation count in Group ...")]
62         [Property("SPEC", " Tizen.Content.MediaContent.Group M")]
63         [Property("SPEC_URL", "-")]
64         [Property("CRITERIA", "MR")]
65         [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
66         public static async Task groupmediaCount_CHECK_RESULT()
67         {
68             ContentFilter filter = new ContentFilter();
69             filter.GroupType = MediaGroupType.DisplayName;
70             Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter);
71             await groupListTask;
72             IEnumerable<Group> groups = groupListTask.Result;
73             foreach (Group group in groups)
74             {
75                 Assert.IsTrue(group.GetMediaInformationCount(filter) > 0, "Failed to get the media information count from group");
76             }
77         }
78
79         [Test]
80         [Category("P1")]
81         [Description("Test for MediaInformation in Group ...")]
82         [Property("SPEC", " Tizen.Content.MediaContent.Group M")]
83         [Property("SPEC_URL", "-")]
84         [Property("CRITERIA", "MR")]
85         [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
86         public static async Task groupmediaInfo_CHECK_RESULT()
87         {
88             ContentFilter filter = new ContentFilter();
89             filter.GroupType = MediaGroupType.DisplayName;
90             Task<IEnumerable<Group>> groupListTask = ContentManager.Database.SelectAsync<Group>(filter);
91             await groupListTask;
92             IEnumerable<Group> groups = groupListTask.Result;
93             foreach (Group group in groups)
94             {
95                 try
96                 {
97                     Task<IEnumerable<MediaInformation>> mediaListTask = group.GetMediaInformationsAsync(filter);
98                     await mediaListTask;
99                 }
100                 catch(Exception)
101                 {
102                     Assert.Fail();
103                 }
104             }
105         }
106
107     }
108 }