/* * 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.Utils; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace LibTVRefCommonPortable.Stubs { /// /// A unit testing stub of IApplicationManagerAPIs. /// public class ApplicationManagerAPITestStub : IApplicationManagerAPIs { /// /// A method provides installed application list. /// /// An installed application list public Task> GetAllInstalledApplication() { return Task.Run(() => { List installedApps = new List(); installedApps.Add(new InstalledApp { Applabel = "app1", AppID = "app1", IconPath = "path/app1", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "app2.removable", AppID = "app2.removable", IconPath = "path/app2", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "invalid.app3.noid", IconPath = "path/app3", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "app4.noicon", AppID = "app4.noicon", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "app5.nolabel", AppID = "app5.nolabel", IconPath = "path/app5", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "invalid.org.tizen.xahome", AppID = "org.tizen.xahome", IconPath = "path/app3", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "invalid.org.tizen.xaapps", AppID = "org.tizen.xaapps", IconPath = "path/app4", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "invalid.org.tizen.xamediahub", AppID = "org.tizen.xamediahub", IconPath = "path/app5", InstalledTime = new DateTime(2017, 05, 02), }); installedApps.Add(new InstalledApp { Applabel = "invalid.org.tizen.settings", AppID = "org.tizen.settings", IconPath = "path/app6", InstalledTime = new DateTime(2017, 05, 02), }); return (IEnumerable)installedApps; }); } /// /// Gets the app ID by the app label /// /// the app label to get /// the app ID of the app label public Task GetAppIDbyAppLabel(string appLabel) { throw new NotImplementedException(); } /// /// Checks whether application is removable /// /// The app ID to get /// If the application is removable, true; otherwise, false public bool GetAppInfoRemovable(string appID) { return appID.Contains("removable"); } /// /// A method provides application information which is matched with the given app ID. /// /// An application ID /// An installed application information public InstalledApp GetInstalledApplication(string applicationId) { return new InstalledApp { AppID = applicationId, Applabel = applicationId, IconPath = "path/" + applicationId, InstalledTime = DateUtils.GetRandomDate(), }; } } }