summaryrefslogtreecommitdiff
path: root/tct-mediacontent-tizen-tests/src/Testcase/TSFolder.cs
blob: 72a8eaabf1f2f7afe866cc7c882853947901a2b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TestFramework;
using Tizen.Content.MediaContent;
namespace TizenTest.Mediacontent
{
    [TestFixture]
    [Description("Tizen.Content.MediaContent.Folder Tests")]
    class TSFolder
    {
        private static string TAG = "TCT";
        [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 Folder count ...")]
        [Property("SPEC", " Tizen.Content.MediaContent.Folder.GetCount M")]
        [Property("SPEC_URL", "-")]
        [Property("CRITERIA", "MR")]
        [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
        public static void folderCount_CHECK_RESULT()
        {
            Tizen.Log.Info(TAG, "Executing TC:folderCount_CHECK_RESULT");
            LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderCount_CHECK_RESULT ");
            ContentFilter filter = new ContentFilter();
            filter.StorageId = "media";
            int Count = ContentManager.Database.GetCount<MediaFolder>(filter);
            Tizen.Log.Info(TAG, "Executing TC:folderCount_CHECK_RESULT count " + Count);
            LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderCount_CHECK_RESULT count " + Count);

            Assert.IsTrue(Count > 0, "Failed to get the folder Count");
        }

        [Test]
        [Category("P1")]
        [Description("Test for Group list ...")]
        [Property("SPEC", " Tizen.Content.MediaContent.Folder.Nanme A")]
        [Property("SPEC_URL", "-")]
        [Property("CRITERIA", "PRW")]
        [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
        public static async Task folderName_CHECK_RESULT()
        {
            try
            {
                Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT");
                LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT ");

                ContentFilter filter = new ContentFilter();
                filter.Condition = "MEDIA_PATH = \'/home/owner/content/uts-media\'";
                IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter);
                foreach (MediaFolder folder in folders)
                {
                    Assert.IsTrue(folder.Name.Length > 0, "Failed to get the folder information");
                    Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT before update folder");
                    LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT before updatefodler");
                    folder.Name = "Test_MediaContent";
                    ContentManager.Database.Update(folder);
                    Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT update folder path " + folder.FolderPath);
                    Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT update folder Id " + folder.StorageId);
                    LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT updated folder");
                    Assert.IsTrue(folder.Name.CompareTo("Test_MediaContent") == 0, "Failed to update the folder name");
                    Tizen.Log.Info(TAG, "Executing TC:folderName_CHECK_RESULT name " + folder.Name);
                    LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderName_CHECK_RESULT name" + folder.Name);
                }
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }

        [Test]
        [Category("P1")]
        [Description("Test for Group list ...")]
        [Property("SPEC", " Tizen.Content.MediaContent.Folder.MediaCount M")]
        [Property("SPEC_URL", "-")]
        [Property("CRITERIA", "MR")]
        [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
        public static async Task folderMediaCount_CHECK_RESULT()
        {
            try
            {
                Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT");
                LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaCount_CHECK_RESULT ");

                ContentFilter filter = new ContentFilter();
                filter.Condition = "MEDIA_PATH = \'/home/owner/content/uts-media\'";
                IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter);
                foreach (MediaFolder folder in folders)
                {
                    Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT mediacount " + folder.GetMediaInformationCount(null));
                    Tizen.Log.Info(TAG, "Executing TC:folderMediaCount_CHECK_RESULT mediacount " + folder.GetMediaInformationCount(null));
                    LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaCount_CHECK_RESULT ");
                    Assert.IsTrue(folder.GetMediaInformationCount(null) > 0, "Failed to get the media information count from the folder");
                    break;
                }
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }

        [Test]
        [Category("P1")]
        [Description("Test for MediaInformation in Folder ...")]
        [Property("SPEC", " Tizen.Content.MediaContent.Folder.MediaInfo M")]
        [Property("SPEC_URL", "-")]
        [Property("CRITERIA", "MR")]
        [Property("AUTHOR", "Praveen Kumar Gattu, gattu.p@samsung.com")]
        public static async Task folderMediaInfo_CHECK_RESULT()
        {
            Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT");
            LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT ");
            ContentFilter filter = new ContentFilter();
            filter.StorageId = "media";
            IEnumerable<MediaFolder> folders = await ContentManager.Database.SelectAsync<MediaFolder>(filter);
            foreach (MediaFolder folder in folders)
            {
                try
                {
                    if (folder.GetMediaInformationCount(null) > 0)
                    {
                        IEnumerable<MediaInformation> infos = await folder.GetMediaInformationsAsync(null);
                    }
                }
                catch (Exception)
                {
                    Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT failed");
                    LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT failed");

                    Assert.Fail();
                }
            }
            Tizen.Log.Info(TAG, "Executing TC:folderMediaInfo_CHECK_RESULT done");
            LogUtils.write(LogUtils.DEBUG, LogUtils.TAG, "Executing TC:folderMediaInfo_CHECK_RESULT done");

            Assert.Pass();
        }

    }
}