2 * Copyright (c) 2017 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using LibTVRefCommonPortable.Utils;
19 using System.Collections.Generic;
20 using System.Threading.Tasks;
22 namespace LibTVRefCommonPortable.Stubs
25 /// A unit testing stub of IApplicationManagerAPIs.
27 public class ApplicationManagerAPITestStub : IApplicationManagerAPIs
30 /// A method for removing all recent applications
32 public void DeleteAllRecentApplication()
34 throw new NotImplementedException();
38 /// A method for removing the specified recent application
40 /// <param name="appId">An application ID</param>
41 public void DeleteRecentApplication(string appId)
43 throw new NotImplementedException();
47 /// A method provides installed application list.
49 /// <returns>An installed application list</returns>
50 public Task<IEnumerable<InstalledApp>> GetAllInstalledApplication()
54 List<InstalledApp> installedApps = new List<InstalledApp>();
56 installedApps.Add(new InstalledApp
60 IconPath = "path/app1",
61 InstalledTime = new DateTime(2017, 05, 02),
64 installedApps.Add(new InstalledApp
66 Applabel = "app2.removable",
67 AppID = "app2.removable",
68 IconPath = "path/app2",
69 InstalledTime = new DateTime(2017, 05, 02),
72 installedApps.Add(new InstalledApp
74 Applabel = "invalid.org.tizen.xahome",
75 AppID = "org.tizen.xahome",
76 IconPath = "path/app3",
77 InstalledTime = new DateTime(2017, 05, 02),
80 installedApps.Add(new InstalledApp
82 Applabel = "invalid.org.tizen.xaapps",
83 AppID = "org.tizen.xaapps",
84 IconPath = "path/app4",
85 InstalledTime = new DateTime(2017, 05, 02),
88 installedApps.Add(new InstalledApp
90 Applabel = "invalid.org.tizen.xamediahub",
91 AppID = "org.tizen.xamediahub",
92 IconPath = "path/app5",
93 InstalledTime = new DateTime(2017, 05, 02),
96 installedApps.Add(new InstalledApp
98 Applabel = "invalid.org.tizen.settings",
99 AppID = "org.tizen.settings",
100 IconPath = "path/app6",
101 InstalledTime = new DateTime(2017, 05, 02),
104 return (IEnumerable<InstalledApp>)installedApps;
109 /// Gets the app ID by the app label
111 /// <param name="appLabel">the app label to get</param>
112 /// <returns>the app ID of the app label</returns>
113 public Task<string> GetAppIDbyAppLabel(string appLabel)
115 throw new NotImplementedException();
119 /// Checks whether application is removable
121 /// <param name="appID">The app ID to get</param>
122 /// <returns>If the application is removable, true; otherwise, false</returns>
123 public bool GetAppInfoRemovable(string appID)
125 return appID.Contains("removable");
129 /// A method provides application information which is matched with the given app ID.
131 /// <param name="applicationId">An application ID</param>
132 /// <returns>An installed application information</returns>
133 public InstalledApp GetInstalledApplication(string applicationId)
135 return new InstalledApp
137 AppID = applicationId,
138 Applabel = applicationId,
139 IconPath = "path/" + applicationId,
140 InstalledTime = DateUtils.GetRandomDate(),
145 /// A method provides a recent application list.
147 /// <returns>A Recent application list.</returns>
148 public IEnumerable<RecentApp> GetRecentApplications()
150 IList<RecentApp> testData = new List<RecentApp>();
152 testData.Add(new RecentApp
154 InstanceID = "recentapp1",
155 InstanceLabel = "recentapp1",
156 AppID = "org.tizen.recentapp1",
157 Applabel = "recentapp1",
158 IconPath = "/test/recentapp1",
159 LaunchedTime = new DateTime(2014, 11, 12),
160 Uri = "uri/recentapp1",
161 ScreenShot = "screenshot/recentapp1",
163 testData.Add(new RecentApp
165 InstanceID = "recentapp2.noscreenshot",
166 InstanceLabel = "recentapp2.noscreenshot",
167 AppID = "org.tizen.recentapp2.noscreenshot",
168 Applabel = "recentapp2.noscreenshot",
169 IconPath = "/test/recentapp2",
170 LaunchedTime = new DateTime(2014, 11, 12),
171 Uri = "uri/recentapp2",
173 testData.Add(new RecentApp
175 InstanceID = "invalid.recentapp3.nolabel",
176 AppID = "invalid.org.tizen.recentapp3.nolabel",
177 IconPath = "/test/recentapp3",
178 LaunchedTime = new DateTime(2014, 11, 12),
179 Uri = "uri/recentapp3",
180 ScreenShot = "screenshot/recentapp3",
182 testData.Add(new RecentApp
184 InstanceID = "invalid.recentapp4.notime",
185 AppID = "invalid.org.tizen.recentapp4.notime",
186 Applabel = "recentapp4.notime",
187 IconPath = "/test/recentapp4",
188 Uri = "uri/recentapp4",
189 ScreenShot = "screenshot/recentapp4",
191 testData.Add(new RecentApp
193 InstanceID = "recentapp5",
194 InstanceLabel = "recentapp5",
195 AppID = "org.tizen.recentapp5",
196 Applabel = "recentapp5",
197 IconPath = "/test/recentapp5",
198 LaunchedTime = new DateTime(2017, 05, 02),
199 Uri = "uri/recentapp5",
200 ScreenShot = "screenshot/recentapp5",
202 testData.Add(new RecentApp
204 InstanceID = "recentapp6",
205 InstanceLabel = "recentapp6",
206 AppID = "org.tizen.recentapp6",
207 Applabel = "recentapp6",
208 IconPath = "/test/recentapp6",
209 LaunchedTime = new DateTime(2017, 02, 26),
210 Uri = "uri/recentapp6",
211 ScreenShot = "screenshot/recentapp6",
213 testData.Add(new RecentApp
215 InstanceID = "recentapp7",
216 InstanceLabel = "recentapp7",
217 AppID = "org.tizen.recentapp7",
218 Applabel = "recentapp7",
219 IconPath = "/test/recentapp7",
220 LaunchedTime = new DateTime(2016, 04, 25),
221 Uri = "uri/recentapp7",
222 ScreenShot = "screenshot/recentapp7",