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 provides installed application list.
32 /// <returns>An installed application list</returns>
33 public Task<IEnumerable<InstalledApp>> GetAllInstalledApplication()
37 List<InstalledApp> installedApps = new List<InstalledApp>();
39 installedApps.Add(new InstalledApp
43 IconPath = "path/app1",
44 InstalledTime = new DateTime(2017, 05, 02),
47 installedApps.Add(new InstalledApp
49 Applabel = "app2.removable",
50 AppID = "app2.removable",
51 IconPath = "path/app2",
52 InstalledTime = new DateTime(2017, 05, 02),
55 installedApps.Add(new InstalledApp
57 Applabel = "invalid.app3.noid",
58 IconPath = "path/app3",
59 InstalledTime = new DateTime(2017, 05, 02),
62 installedApps.Add(new InstalledApp
64 Applabel = "app4.noicon",
65 AppID = "app4.noicon",
66 InstalledTime = new DateTime(2017, 05, 02),
69 installedApps.Add(new InstalledApp
71 Applabel = "app5.nolabel",
72 AppID = "app5.nolabel",
73 IconPath = "path/app5",
74 InstalledTime = new DateTime(2017, 05, 02),
77 installedApps.Add(new InstalledApp
79 Applabel = "invalid.org.tizen.xahome",
80 AppID = "org.tizen.xahome",
81 IconPath = "path/app3",
82 InstalledTime = new DateTime(2017, 05, 02),
85 installedApps.Add(new InstalledApp
87 Applabel = "invalid.org.tizen.xaapps",
88 AppID = "org.tizen.xaapps",
89 IconPath = "path/app4",
90 InstalledTime = new DateTime(2017, 05, 02),
93 installedApps.Add(new InstalledApp
95 Applabel = "invalid.org.tizen.xamediahub",
96 AppID = "org.tizen.xamediahub",
97 IconPath = "path/app5",
98 InstalledTime = new DateTime(2017, 05, 02),
101 installedApps.Add(new InstalledApp
103 Applabel = "invalid.org.tizen.settings",
104 AppID = "org.tizen.settings",
105 IconPath = "path/app6",
106 InstalledTime = new DateTime(2017, 05, 02),
109 return (IEnumerable<InstalledApp>)installedApps;
114 /// Gets the app ID by the app label
116 /// <param name="appLabel">the app label to get</param>
117 /// <returns>the app ID of the app label</returns>
118 public Task<string> GetAppIDbyAppLabel(string appLabel)
120 throw new NotImplementedException();
124 /// Checks whether application is removable
126 /// <param name="appID">The app ID to get</param>
127 /// <returns>If the application is removable, true; otherwise, false</returns>
128 public bool GetAppInfoRemovable(string appID)
130 return appID.Contains("removable");
134 /// A method provides application information which is matched with the given app ID.
136 /// <param name="applicationId">An application ID</param>
137 /// <returns>An installed application information</returns>
138 public InstalledApp GetInstalledApplication(string applicationId)
140 return new InstalledApp
142 AppID = applicationId,
143 Applabel = applicationId,
144 IconPath = "path/" + applicationId,
145 InstalledTime = DateUtils.GetRandomDate(),