Revert "Add Test cases for app shortcut, managedapps"
[profile/tv/apps/dotnet/home.git] / LibTVRefCommonPortable / Utils / ApplicationManagerUtils.cs
index 138d211..62d8b80 100644 (file)
@@ -1,20 +1,4 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using LibTVRefCommonPortable.Stubs;
+
 using System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
@@ -49,11 +33,127 @@ namespace LibTVRefCommonPortable.Utils
         }
 
         /// <summary>
+        /// A unit testing stub of IApplicationManagerAPIs.
+        /// </summary>
+        private class TestingStub : IApplicationManagerAPIs
+        {
+            public void DeleteAllRecentApplication()
+            {
+                throw new NotImplementedException();
+            }
+
+            public void DeleteRecentApplication(string appId)
+            {
+                throw new NotImplementedException();
+            }
+
+            public Task<Dictionary<string, string[]>> GetAllInstalledApplication()
+            {
+                throw new NotImplementedException();
+            }
+
+            public Task<string> GetAppIDbyAppLabel(string appLabel)
+            {
+                throw new NotImplementedException();
+            }
+
+            public bool GetAppInfoRemovable(string appID)
+            {
+                throw new NotImplementedException();
+            }
+
+            public Dictionary<string, string> GetInstalledApplication(string applicationId)
+            {
+                throw new NotImplementedException();
+            }
+
+            public IEnumerable<RecentApp> GetRecentApplications()
+            {
+                IList<RecentApp> testData = new List<RecentApp>();
+
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "recentapp1",
+                    InstanceLabel = "recentapp1",
+                    AppID = "org.tizen.recentapp1",
+                    Applabel = "recentapp1",
+                    IconPath = "/test/recentapp1",
+                    LaunchedTime = new DateTime(2014, 11, 12),
+                    Uri = "uri/recentapp1",
+                    ScreenShot = "screenshot/recentapp1",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "recentapp2.noscreenshot",
+                    InstanceLabel = "recentapp2.noscreenshot",
+                    AppID = "org.tizen.recentapp2.noscreenshot",
+                    Applabel = "recentapp2.noscreenshot",
+                    IconPath = "/test/recentapp2",
+                    LaunchedTime = new DateTime(2014, 11, 12),
+                    Uri = "uri/recentapp2",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "invalid.recentapp3.nolabel",
+                    AppID = "invalid.org.tizen.recentapp3.nolabel",
+                    IconPath = "/test/recentapp3",
+                    LaunchedTime = new DateTime(2014, 11, 12),
+                    Uri = "uri/recentapp3",
+                    ScreenShot = "screenshot/recentapp3",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "invalid.recentapp4.notime",
+                    AppID = "invalid.org.tizen.recentapp4.notime",
+                    Applabel = "recentapp4.notime",
+                    IconPath = "/test/recentapp4",
+                    Uri = "uri/recentapp4",
+                    ScreenShot = "screenshot/recentapp4",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "recentapp5",
+                    InstanceLabel = "recentapp5",
+                    AppID = "org.tizen.recentapp5",
+                    Applabel = "recentapp5",
+                    IconPath = "/test/recentapp5",
+                    LaunchedTime = new DateTime(2017, 05, 02),
+                    Uri = "uri/recentapp5",
+                    ScreenShot = "screenshot/recentapp5",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "recentapp6",
+                    InstanceLabel = "recentapp6",
+                    AppID = "org.tizen.recentapp6",
+                    Applabel = "recentapp6",
+                    IconPath = "/test/recentapp6",
+                    LaunchedTime = new DateTime(2017, 02, 26),
+                    Uri = "uri/recentapp6",
+                    ScreenShot = "screenshot/recentapp6",
+                });
+                testData.Add(new RecentApp
+                {
+                    InstanceID = "recentapp7",
+                    InstanceLabel = "recentapp7",
+                    AppID = "org.tizen.recentapp7",
+                    Applabel = "recentapp7",
+                    IconPath = "/test/recentapp7",
+                    LaunchedTime = new DateTime(2016, 04, 25),
+                    Uri = "uri/recentapp7",
+                    ScreenShot = "screenshot/recentapp7",
+                });
+
+                return testData;
+            }
+        }
+
+        /// <summary>
         /// A constructor
         /// </summary>
         private ApplicationManagerUtils()
         {
-            applicationManagerAPIs = new ApplicationManagerAPITestStub();
+            applicationManagerAPIs = new TestingStub();
 
             try
             {
@@ -100,7 +200,7 @@ namespace LibTVRefCommonPortable.Utils
         /// </summary>
         /// <param name="appID">The app Id to get</param>
         /// <returns>The information of the installed application</returns>
-        public InstalledApp GetInstalledApplication(string appID)
+        public Dictionary<string, string> GetInstalledApplication(string appID)
         {
             return applicationManagerAPIs.GetInstalledApplication(appID);
         }
@@ -109,7 +209,7 @@ namespace LibTVRefCommonPortable.Utils
         /// Gets the information of the installed applications asynchronously
         /// </summary>
         /// <returns>The list of the installed applications</returns>
-        public Task<IEnumerable<InstalledApp>> GetAllInstalledApplication()
+        public Task<Dictionary<string, string[]>> GetAllInstalledApplication()
         {
             return applicationManagerAPIs.GetAllInstalledApplication();
         }