Revert "Add Test cases for app shortcut, managedapps"
authorChulSeung Kim <charles0.kim@samsung.com>
Wed, 7 Jun 2017 06:07:23 +0000 (15:07 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:56 +0000 (18:34 +0900)
This reverts commit 7b8ebc0fd5ef30b043cd1398d339ff1d0b82d750.

Change-Id: I15dc252ad24b2bb2b001e2a71b1f4823c6ebbdc4

20 files changed:
HomeUnitTest/AppShortcutTestCases.cs [deleted file]
HomeUnitTest/HomeUnitTest.csproj
HomeUnitTest/ManagedAppsTestCases.cs [deleted file]
HomeUnitTest/RecentTesting.cs [moved from HomeUnitTest/RecentTestCases.cs with 74% similarity]
LibTVRefCommonPortable/DataModels/CommandAction.cs
LibTVRefCommonPortable/DataModels/StateDescription.cs
LibTVRefCommonPortable/LibTVRefCommonPortable.csproj
LibTVRefCommonPortable/Models/AppShortcutController.cs
LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs [deleted file]
LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs [deleted file]
LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs [deleted file]
LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs [deleted file]
LibTVRefCommonPortable/Utils/AppShortcutStorage.cs
LibTVRefCommonPortable/Utils/ApplicationManagerUtils.cs
LibTVRefCommonPortable/Utils/FileSystemUtils.cs
LibTVRefCommonPortable/Utils/IApplicationManagerAPIs.cs
LibTVRefCommonPortable/Utils/IFileSystemAPIs.cs
LibTVRefCommonPortable/Utils/MediaContentUtils.cs
LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs
TVApps/TVApps/ViewModels/AppsHolder.cs

diff --git a/HomeUnitTest/AppShortcutTestCases.cs b/HomeUnitTest/AppShortcutTestCases.cs
deleted file mode 100644 (file)
index e777fb4..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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 System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using LibTVRefCommonPortable.Models;
-using System.Threading.Tasks;
-using System.Linq;
-using LibTVRefCommonPortable.DataModels;
-
-namespace HomeUnitTest
-{
-    /// <summary>
-    /// A test cases for AppShortcutController
-    /// </summary>
-    [TestClass]
-    public class AppShortcutTestCases
-    {
-        /// <summary>
-        /// A instance of AppShortcutController
-        /// </summary>
-        private AppShortcutController controller;
-
-        /// <summary>
-        /// All Apps app shortcut name
-        /// </summary>
-        private static readonly string AllApps = "All apps";
-
-        /// <summary>
-        /// MediaHub app shortcut name
-        /// </summary>
-        private static readonly string MediaHub = "Media Hub";
-
-        /// <summary>
-        /// Add pin app shortcut name
-        /// </summary>
-        private static readonly string AddPin = "Add pin";
-
-        /// <summary>
-        /// A constructor that initialize AppShortcutController instance.
-        /// </summary>
-        public AppShortcutTestCases()
-        {
-            controller = new AppShortcutController();
-        }
-
-        #region 추가 테스트 특성
-        //
-        // 테스트를 작성할 때 다음 추가 특성을 사용할 수 있습니다.
-        //
-        // ClassInitialize를 사용하여 클래스의 첫 번째 테스트를 실행하기 전에 코드를 실행합니다.
-        // [ClassInitialize()]
-        // public static void MyClassInitialize(TestContext testContext) { }
-        //
-        // ClassCleanup을 사용하여 클래스의 테스트를 모두 실행한 후에 코드를 실행합니다.
-        // [ClassCleanup()]
-        // public static void MyClassCleanup() { }
-        //
-        // TestInitialize를 사용하여 각 테스트를 실행하기 전에 코드를 실행합니다.
-        // [TestInitialize()]
-        // public void MyTestInitialize() { }
-        //
-        // TestCleanup을 사용하여 각 테스트를 실행한 후에 코드를 실행합니다.
-        // [TestCleanup()]
-        // public void MyTestCleanup() { }
-        //
-        #endregion
-
-
-        [TestMethod]
-        public async Task AppShortcutGetInstalledAppsTest()
-        {
-            var installedApps = await controller.GetInstalledApps();
-
-            foreach (var app in installedApps)
-            {
-                Console.Out.WriteLine("App ID : " + app.AppID);
-                Console.Out.WriteLine("Installed Date : " + app.Installed);
-
-                // Err : CurrentStateDescription should not be null
-                Assert.AreNotEqual(app.CurrentStateDescription, null,
-                    "StateDescription CurrentStateDescription is null!!!");
-
-                // Err : removable app property check
-                if (app.CurrentStateDescription.Label.Contains("removable") &&
-                    app.IsRemovable == false)
-                {
-                    Assert.Fail("Removable is failed");
-                }
-
-                // Err : Invalid state description removing.
-                if (app.CurrentStateDescription.Label.Contains("invalid"))
-                {
-                    Assert.Fail("Invalid App Shortcut included!!!");
-                }
-            }
-        }
-
-        [TestMethod]
-        public void AppShortcutGetDefaultShortcutsTest()
-        {
-            var defaultShortcuts = controller.GetDefaultShortcuts();
-
-            // Req : Order of default shortcuts is All apps > Media Hub > Add pin
-            Assert.AreNotEqual(defaultShortcuts.ElementAt(0).CurrentStateDescription,
-                null, "All Apps CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(defaultShortcuts.ElementAt(0).CurrentStateDescription.Label, AllApps);
-
-            Assert.AreNotEqual(defaultShortcuts.ElementAt(1).CurrentStateDescription,
-                null, "Media Hub CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(defaultShortcuts.ElementAt(1).CurrentStateDescription.Label, MediaHub);
-
-            Assert.AreNotEqual(defaultShortcuts.ElementAt(2).CurrentStateDescription,
-                null, "Add pin CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(defaultShortcuts.ElementAt(2).CurrentStateDescription.Label, AddPin);
-        }
-
-        [TestMethod]
-        public async Task AppShortcutGetPinnedAppsWithDefaultShortcutsTest()
-        {
-            var pinnedApps = await controller.GetPinnedAppsWithDefaultShortcuts();
-
-            // Req : A Maximum number of pinned apps is 10. + All apps, Media Hub, Add pin
-            Assert.IsTrue(pinnedApps.Count() <= 13, "A Maximum number of pinned apps is 10!!! NOT " + pinnedApps.Count());
-
-            // Req : Order of default shortcuts is All apps > Media Hub > Add pin
-            Assert.AreNotEqual(pinnedApps.ElementAt(0).CurrentStateDescription,
-                null, "All Apps CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(pinnedApps.ElementAt(0).CurrentStateDescription.Label, AllApps);
-
-            Assert.AreNotEqual(pinnedApps.ElementAt(1).CurrentStateDescription,
-                null, "Media Hub CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(pinnedApps.ElementAt(1).CurrentStateDescription.Label, MediaHub);
-
-            Assert.AreNotEqual(pinnedApps.ElementAt(pinnedApps.Count() - 1).CurrentStateDescription,
-                null, "Add pin CurrentStateDescription is invalid!!!");
-            Assert.AreEqual(pinnedApps.ElementAt(pinnedApps.Count() - 1).CurrentStateDescription.Label, AddPin);
-
-            foreach (var shortcut in pinnedApps)
-            {
-                // Err : shortcut should be AppShortcutInfo
-                if ((shortcut is AppShortcutInfo) == false)
-                {
-                    Assert.Fail("Invalid ShortCut type!!!");
-                }
-
-                var app = shortcut as AppShortcutInfo;
-
-                Console.Out.WriteLine("ID : " + app.AppID);
-                Console.Out.WriteLine("Label : " + app.CurrentStateDescription.Label);
-                Console.Out.WriteLine("Installed : " + app.Installed);
-
-                // Err : CurrentStateDescription should not be null
-                Assert.AreNotEqual(app.CurrentStateDescription, null,
-                    "StateDescription CurrentStateDescription is null!!!");
-
-                // Err : Both ID and Label should not be null
-                Assert.IsFalse((app.AppID == null || app.AppID.Length < 1) &&
-                    (app.CurrentStateDescription.Label == null || app.CurrentStateDescription.Label.Length < 1),
-                        "Both ID and Label should not be null!!!");
-
-                // Err : AppID should be exist
-                if (app.AppID == null)
-                {
-                    if (app.CurrentStateDescription.Label.CompareTo(AllApps) != 0 &&
-                        app.CurrentStateDescription.Label.CompareTo(MediaHub) != 0 &&
-                        app.CurrentStateDescription.Label.CompareTo(AddPin) != 0)
-                    {
-                        Assert.Fail("App ID is missing!!! " + app.CurrentStateDescription.Label);
-                    }
-                }
-                else
-                {
-                    // Req : TVHome, TVApps, MediaHub, Settings should not be pinned.
-                    Assert.IsFalse(app.AppID.Contains("xahome"), "TVHome should not be pinned");
-                    Assert.IsFalse(app.AppID.Contains("xaapps"), "TVApps should not be pinned");
-                    Assert.IsFalse(app.AppID.Contains("xamediahub"), "MediaHub should not be pinned");
-                    Assert.IsFalse(app.AppID.Contains("settings"), "Settings should not be pinned");
-                }
-
-                // Err : removable app property check
-                if (app.CurrentStateDescription.Label.Contains("removable") &&
-                    app.IsRemovable == false)
-                {
-                    Assert.Fail("Removable is failed");
-                }
-
-                // Err : Invalid state description removing.
-                if (app.CurrentStateDescription.Label.Contains("invalid"))
-                {
-                    Assert.Fail("Invalid App Shortcut included!!!");
-                }
-            }
-        }
-
-        [TestMethod]
-        public async Task AppShortcutGetPinnedAppsAppIDsTest()
-        {
-            var pinnedAppsIDs = await controller.GetPinnedAppsAppIDs();
-
-            // Req : A Maximum number of pinned apps is 10.
-            Assert.IsTrue(pinnedAppsIDs.Count() <= 10,
-                "A Maximum number of pinned apps is 10!!! NOT " + pinnedAppsIDs.Count());
-
-            foreach (var appID in pinnedAppsIDs.Keys)
-            {
-                // Err : AppID should not be null or empty.
-                Assert.AreNotEqual(appID, null, "App ID should not be null");
-                Assert.IsFalse(appID.Length < 1, "App ID should not be empty");
-
-                // Req : TVHome, TVApps, MediaHub, Settings should not be pinned.
-                Assert.IsFalse(appID.Contains("xahome"), "TVHome should not be pinned");
-                Assert.IsFalse(appID.Contains("xaapps"), "TVApps should not be pinned");
-                Assert.IsFalse(appID.Contains("xamediahub"), "MediaHub should not be pinned");
-                Assert.IsFalse(appID.Contains("settings"), "Settings should not be pinned");
-            }
-        }
-    }
-}
index 0a0b50b..7bf1694 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\packages\MSTest.TestAdapter.1.1.14\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.14\build\net45\MSTest.TestAdapter.props')" />
+  <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>
+    </Reference>
+    <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AppShortcutTestCases.cs" />
-    <Compile Include="ManagedAppsTestCases.cs" />
-    <Compile Include="RecentTestCases.cs" />
+    <Compile Include="RecentTesting.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -70,6 +77,8 @@
     </PropertyGroup>
     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props'))" />
     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets'))" />
+    <Error Condition="!Exists('..\packages\Xamarin.Forms.2.3.5-r233-008\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.5-r233-008\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />
   </Target>
   <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" />
+  <Import Project="..\packages\Xamarin.Forms.2.3.5-r233-008\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.5-r233-008\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
 </Project>
\ No newline at end of file
diff --git a/HomeUnitTest/ManagedAppsTestCases.cs b/HomeUnitTest/ManagedAppsTestCases.cs
deleted file mode 100644 (file)
index 4d12be1..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 Microsoft.VisualStudio.TestTools.UnitTesting;
-using LibTVRefCommonPortable.Models;
-
-namespace HomeUnitTest
-{
-    /// <summary>
-    /// A Test cases for ManagedApps class.
-    /// </summary>
-    [TestClass]
-    public class ManagedAppsTestCases
-    {
-        /// <summary>
-        /// TVHome package ID
-        /// </summary>
-        private static readonly string Home = "org.tizen.xahome";
-
-        /// <summary>
-        /// TVApps package ID
-        /// </summary>
-        private static readonly string Apps = "org.tizen.xaapps";
-
-        /// <summary>
-        /// Mediahub package ID
-        /// </summary>
-        private static readonly string Mediahub = "org.tizen.xamediahub";
-
-        /// <summary>
-        /// Settings package ID
-        /// </summary>
-        private static readonly string Settings = "org.tizen.settings";
-
-        [TestMethod]
-        public void ManagerAppsIsHiddenRecentAppTest()
-        {
-            Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Home), "TVHome should not be hidden in Recents");
-            Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Apps), "Apps should not be hidden in Recents");
-            Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Mediahub), "Mediahub should not be hidden in Recents");
-            Assert.IsTrue(ManagedApps.IsHiddenRecentApp(Settings), "Settings should not be hidden in Recents");
-        }
-
-        [TestMethod]
-        public void ManagerAppsIsNonPinnableAppsTest()
-        {
-            Assert.IsTrue(ManagedApps.IsNonPinnableApps(Home), "TVHome should not be pinned");
-            Assert.IsTrue(ManagedApps.IsNonPinnableApps(Apps), "Apps should not be pinned");
-            Assert.IsTrue(ManagedApps.IsNonPinnableApps(Mediahub), "Mediahub should not be pinned");
-            Assert.IsTrue(ManagedApps.IsNonPinnableApps(Settings), "Settings should not be pinned");
-        }
-    }
-}
similarity index 74%
rename from HomeUnitTest/RecentTestCases.cs
rename to HomeUnitTest/RecentTesting.cs
index e9cba17..50f90b0 100644 (file)
@@ -22,31 +22,22 @@ using System.Linq;
 
 namespace HomeUnitTest
 {
-    /// <summary>
-    /// A test cases for RecentShortcutController
-    /// </summary>
     [TestClass]
-    public class RecentTestCases
+    public class RecentTesting
     {
-        /// <summary>
-        /// A instance of RecentShortcutController
-        /// </summary>
-        private RecentShortcutController controller;
-
-        /// <summary>
-        /// A constructor that initializes RecentShortcutController instance.
-        /// </summary>
-        public RecentTestCases()
+        public RecentTesting()
         {
-            controller = new RecentShortcutController();
+
         }
 
         [TestMethod]
-        public void RecentGetListTest()
+        public void GetListTest()
         {
-            var recents = controller.GetList();
+            RecentShortcutController recentShortcutController = new RecentShortcutController();
+
+            var recents = recentShortcutController.GetList();
 
-            // R : MAX number of recent = 10
+            // MAX number of recent = 10
             if (recents.Count() > 10)
             {
                 Assert.Fail("Too many Recent!!!, Returned = " + recents.Count());
@@ -73,7 +64,7 @@ namespace HomeUnitTest
                         break;
                 }
 
-                // R : Invalid Recent(id, label has 'invalid') should not included!!!
+                // Invalid Recent(id, label has 'invalid') should not included!!!
                 if (recent.CurrentStateDescription == null ||
                     recent.CurrentStateDescription.Label.ToLower().Contains("invalid"))
                 {
@@ -81,7 +72,7 @@ namespace HomeUnitTest
                 }
             }
 
-            // R : Test Sample Recent is consist of App and Media types.
+            // Test Sample Recent is consist of App and Media types.
             if (isAllMedias || isAllApps)
             {
                 Assert.Fail("Invalid Recent list, All Media({0}), All Apps({1})", isAllMedias, isAllApps);
index 220c7c5..40585c9 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 using System;
+using System.Windows.Input;
+using Xamarin.Forms;
 
 namespace LibTVRefCommonPortable.DataModels
 {
index b3766c5..305ce64 100644 (file)
@@ -17,7 +17,7 @@
 namespace LibTVRefCommonPortable.DataModels
 {
     /// <summary>
-    /// A class represents a state of a Shortcut.
+    /// A class represnts a state of a Shortcut.
     /// </summary>
     public class StateDescription
     {
index 80bb27f..f59578f 100755 (executable)
     <Compile Include="Models\ManagedApps.cs" />
     <Compile Include="Models\RecentShortcutController.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Stubs\ApplicationManagerAPITestStub.cs" />
-    <Compile Include="Stubs\FileSystemAPITestStub.cs" />
-    <Compile Include="Stubs\FileWatcherAPITestStub.cs" />
-    <Compile Include="Stubs\MediaContentAPITestStub.cs" />
     <Compile Include="Utils\AppControlUtils.cs" />
     <Compile Include="Utils\ApplicationManagerUtils.cs" />
     <Compile Include="Utils\AppShortcutStorage.cs" />
index e6cbdd5..21d63de 100755 (executable)
@@ -16,6 +16,7 @@
 
 using System;
 using System.Collections.Generic;
+
 using LibTVRefCommonPortable.DataModels;
 using LibTVRefCommonPortable.Utils;
 using System.Threading.Tasks;
@@ -47,32 +48,38 @@ namespace LibTVRefCommonPortable.Models
 
             var installedAppList = await ApplicationManagerUtils.Instance.GetAllInstalledApplication();
 
-            foreach (var item in installedAppList)
+            foreach (KeyValuePair<string, string[]> item in installedAppList)
             {
-                if (ManagedApps.IsNonPinnableApps(item.AppID))
+                if (ManagedApps.IsNonPinnableApps(item.Key))
                 {
                     continue;
                 }
 
                 var defaultStateDescription = new StateDescription()
                 {
-                    Label = item.Applabel,
-                    IconPath = item.IconPath,
+                    Label = item.Value[0],
+                    IconPath = item.Value[2],
                     Action = new AppControlAction()
                     {
-                        AppID = item.AppID,
+                        AppID = item.Key,
                     }
                 };
 
+                long longDate;
+                if (long.TryParse(item.Value[3], out longDate) == false)
+                {
+                    longDate = long.MinValue;
+                }
+
                 var appShortcutInfo = new AppShortcutInfo()
                 {
-                    IsRemovable = ApplicationManagerUtils.Instance.GetAppInfoRemovable(item.AppID),
-                    Installed = item.InstalledTime,
+                    IsRemovable = ApplicationManagerUtils.Instance.GetAppInfoRemovable(item.Key),
+                    Installed = new DateTime(longDate),
                 };
 
                 appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
                 appShortcutInfo.CurrentStateDescription = defaultStateDescription;
-                appShortcutInfo.AppID = item.AppID;
+                appShortcutInfo.AppID = item.Key;
                 appShortcutInfoList.Add(appShortcutInfo);
             }
 
@@ -217,38 +224,34 @@ namespace LibTVRefCommonPortable.Models
 
             List<ShortcutInfo> returnPinnedAppsInfo = new List<ShortcutInfo>();
 
-            int numberOfPinnedApp = 0;
             foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
             {
-                if (numberOfPinnedApp >= 10)
-                {
-                    break;
-                }
-
-                if (appShortcutInfo.AppID == null ||
-                    appShortcutInfo.AppID.Length < 1)
+                if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID))
                 {
                     continue;
                 }
 
-                if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID))
+                Dictionary<string, string> appInfo = ApplicationManagerUtils.Instance.GetInstalledApplication(appShortcutInfo.AppID);
+
+                if (appInfo == null)
                 {
                     continue;
                 }
 
-                InstalledApp appInfo = ApplicationManagerUtils.Instance.GetInstalledApplication(appShortcutInfo.AppID);
-                if (appInfo == null)
+                string appLabel;
+                string appIconPath;
+
+                if (appInfo.TryGetValue("Label", out appLabel) == false)
                 {
-                    continue;
+                    appLabel = "No Name";
                 }
 
-                string appLabel = appInfo.Applabel ?? "No Name";
-                string appIconPath = appInfo.IconPath ?? DefaultAppIcon;
+                appInfo.TryGetValue("IconPath", out appIconPath);
 
                 var defaultStateDescription = new StateDescription()
                 {
                     Label = appLabel,
-                    IconPath = appIconPath,
+                    IconPath = appIconPath ?? DefaultAppIcon,
                     Action = new AppControlAction
                     {
                         AppID = appShortcutInfo.AppID,
@@ -259,8 +262,6 @@ namespace LibTVRefCommonPortable.Models
                 appShortcutInfo.CurrentStateDescription = defaultStateDescription;
                 appShortcutInfo.IsPinned = true;
                 returnPinnedAppsInfo.Add(appShortcutInfo);
-
-                numberOfPinnedApp += 1;
             }
 
             return returnPinnedAppsInfo;
@@ -305,21 +306,14 @@ namespace LibTVRefCommonPortable.Models
             IEnumerable<AppShortcutInfo> pinned_apps_info = await AppShortcutStorage.Read();
             Dictionary<string, string> pinnedAppsDictionary = new Dictionary<string, string>();
 
-            int numberOfPinnedApp = 0;
             foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
             {
-                if (numberOfPinnedApp >= 10)
-                {
-                    break;
-                }
-
                 if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID))
                 {
                     continue;
                 }
 
                 pinnedAppsDictionary.Add(appShortcutInfo.AppID, appShortcutInfo.AppID);
-                numberOfPinnedApp += 1;
             }
 
             return pinnedAppsDictionary;
diff --git a/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs b/LibTVRefCommonPortable/Stubs/ApplicationManagerAPITestStub.cs
deleted file mode 100644 (file)
index f19f7e8..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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
-{
-    /// <summary>
-    /// A unit testing stub of IApplicationManagerAPIs.
-    /// </summary>
-    public class ApplicationManagerAPITestStub : IApplicationManagerAPIs
-    {
-        /// <summary>
-        /// A method for removing all recent applications
-        /// </summary>
-        public void DeleteAllRecentApplication()
-        {
-            throw new NotImplementedException();
-        }
-
-        /// <summary>
-        /// A method for removing the specified recent application
-        /// </summary>
-        /// <param name="appId">An application ID</param>
-        public void DeleteRecentApplication(string appId)
-        {
-            throw new NotImplementedException();
-        }
-
-        /// <summary>
-        /// A method provides installed application list.
-        /// </summary>
-        /// <returns>An installed application list</returns>
-        public Task<IEnumerable<InstalledApp>> GetAllInstalledApplication()
-        {
-            return Task.Run(() =>
-            {
-                List<InstalledApp> installedApps = new List<InstalledApp>();
-
-                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.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<InstalledApp>)installedApps;
-            });
-        }
-
-        /// <summary>
-        /// Gets the app ID by the app label
-        /// </summary>
-        /// <param name="appLabel">the app label to get</param>
-        /// <returns>the app ID of the app label</returns>
-        public Task<string> GetAppIDbyAppLabel(string appLabel)
-        {
-            throw new NotImplementedException();
-        }
-
-        /// <summary>
-        /// Checks whether application is removable
-        /// </summary>
-        /// <param name="appID">The app ID to get</param>
-        /// <returns>If the application is removable, true; otherwise, false</returns>
-        public bool GetAppInfoRemovable(string appID)
-        {
-            return appID.Contains("removable");
-        }
-
-        /// <summary>
-        /// A method provides application information which is matched with the given app ID.
-        /// </summary>
-        /// <param name="applicationId">An application ID</param>
-        /// <returns>An installed application information</returns>
-        public InstalledApp GetInstalledApplication(string applicationId)
-        {
-            return new InstalledApp
-            {
-                AppID = applicationId,
-                Applabel = applicationId,
-                IconPath = "path/" + applicationId,
-                InstalledTime = DateUtils.GetRandomDate(),
-            };
-        }
-
-        /// <summary>
-        /// A method provides a recent application list.
-        /// </summary>
-        /// <returns>A Recent application list.</returns>
-        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;
-        }
-    }
-}
diff --git a/LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs b/LibTVRefCommonPortable/Stubs/FileSystemAPITestStub.cs
deleted file mode 100644 (file)
index bc3955e..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.IO;
-using System.Text;
-
-namespace LibTVRefCommonPortable.Stubs
-{
-    /// <summary>
-    /// A unit test stub for FileSystemUtils
-    /// </summary>
-    public class FileSystemAPITestStub : IFileSystemAPIs
-    {
-        /// <summary>
-        /// A directory path which should be used for app data storing.
-        /// </summary>
-        public string AppDataStorage
-        {
-            get
-            {
-                return "test_app_data_path/";
-            }
-        }
-
-        /// <summary>
-        /// A directory path which should be used for app resource storing.
-        /// </summary>
-        public string AppResourceStorage
-        {
-            get
-            {
-                return "test_app_resource_path/";
-            }
-        }
-
-        /// <summary>
-        /// A directory path which should be used for sharing between apps.
-        /// </summary>
-        public string PlatformShareStorage
-        {
-            get
-            {
-                return "test_platform_share_path/";
-            }
-        }
-
-        /// <summary>
-        /// A method closes the file.
-        /// </summary>
-        /// <param name="stream">A file descriptor</param>
-        public void CloseFile(Stream stream)
-        {
-        }
-
-        /// <summary>
-        /// A method flushing the stream to write remains.
-        /// </summary>
-        /// <param name="stream">A file descriptor</param>
-        public void Flush(Stream stream)
-        {
-        }
-
-        /// <summary>
-        /// A method checks if a file existence in the file system.
-        /// </summary>
-        /// <param name="filePath">A file path</param>
-        /// <returns>An existence of the file</returns>
-        public bool IsFileExist(string filePath)
-        {
-            return true;
-        }
-
-        /// <summary>
-        /// A method checks if file is read to use.
-        /// </summary>
-        /// <param name="filePath">A file path</param>
-        /// <returns>A status of ready</returns>
-        public bool IsFileReady(string filePath)
-        {
-            return true;
-        }
-
-        /// <summary>
-        /// A method opens a file on the given mode.
-        /// </summary>
-        /// <param name="filePath">A file path</param>
-        /// <param name="mode">An opening mode</param>
-        /// <returns>A file descriptor</returns>
-        public Stream OpenFile(string filePath, UtilFileMode mode)
-        {
-            if (mode != UtilFileMode.Open)
-            {
-                throw new NotImplementedException();
-            }
-
-            if (filePath.Contains("pinned_apps_info"))
-            {
-                StringBuilder pinnedApps = new StringBuilder();
-
-                pinnedApps.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
-                pinnedApps.Append("<ArrayOfAppShortcutInfo");
-                pinnedApps.Append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
-                pinnedApps.Append(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.xahome</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.xaapps</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.xamediahub</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.settings</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.TocToc.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.YouTube.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Toda.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly4.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly5.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly6.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly7.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly8.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly9.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly10.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID>org.tizen.example.Butterfly11.Tizen</AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("  <AppShortcutInfo>");
-                pinnedApps.Append("    <AppID></AppID>");
-                pinnedApps.Append("  </AppShortcutInfo>");
-                pinnedApps.Append("</ArrayOfAppShortcutInfo>");
-
-                MemoryStream stream = new MemoryStream();
-                StreamWriter writer = new StreamWriter(stream);
-                writer.Write(pinnedApps.ToString());
-                writer.Flush();
-                stream.Position = 0;
-                return stream;
-            }
-
-            throw new NotImplementedException();
-        }
-    }
-}
diff --git a/LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs b/LibTVRefCommonPortable/Stubs/FileWatcherAPITestStub.cs
deleted file mode 100644 (file)
index fe4aa6b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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;
-
-namespace LibTVRefCommonPortable.Stubs
-{
-    /// <summary>
-    /// A unit test stub for FileSystemUtils
-    /// </summary>
-    public class FileWatcherAPITestStub : IFileSystemWatcherAPIs
-    {
-        /// <summary>
-        /// A EventHandler for the file system watcher.
-        /// </summary>
-        public event EventHandler<EventArgs> CustomChanged;
-
-        /// <summary>
-        /// A method starts the file system watcher.
-        /// </summary>
-        public void Run()
-        {
-            CustomChanged?.Invoke(this, EventArgs.Empty);
-
-        }
-    }
-}
diff --git a/LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs b/LibTVRefCommonPortable/Stubs/MediaContentAPITestStub.cs
deleted file mode 100644 (file)
index 2eeefb9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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;
-
-namespace LibTVRefCommonPortable.Stubs
-{
-    /// <summary>
-    /// A unit testing stub for MediaContentUtils
-    /// </summary>
-    public class MediaContentAPITestStub : IMediaContentAPIs
-    {
-        /// <summary>
-        /// A method for getting recently played media content list
-        /// </summary>
-        /// <param name="limitation">Maximum count of list</param>
-        /// <returns>The recently played media content list</returns>
-        public IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation)
-        {
-            IList<RecentlyPlayedMedia> recentlyPlayed = new List<RecentlyPlayedMedia>();
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media1",
-                ThumbnailPath = "thumbnail/recent_media1",
-                FilePath = "filepath/recent_media1",
-                DisplayName = "recent_media1",
-                PlayedAt = new DateTime(2017, 05, 22),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "invalid.recent_media2.nofilepath",
-                ThumbnailPath = "invalid.recent_media2.nofilepath",
-                DisplayName = "invalid.recent_media2.nofilepath",
-                PlayedAt = new DateTime(2017, 2, 26),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media3.nothumbnail",
-                FilePath = "filepath/recent_media3.nothumbnail",
-                DisplayName = "recent_media3.nothumbnail",
-                PlayedAt = new DateTime(2016, 4, 25),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media4",
-                ThumbnailPath = "thumbnail/recent_media4",
-                FilePath = "filepath/recent_media4",
-                DisplayName = "recent_media4",
-                PlayedAt = new DateTime(2015, 12, 7),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media5",
-                ThumbnailPath = "thumbnail/recent_media5",
-                FilePath = "filepath/recent_media5",
-                DisplayName = "recent_media5",
-                PlayedAt = new DateTime(2015, 10, 1),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media6",
-                ThumbnailPath = "thumbnail/recent_media6",
-                FilePath = "filepath/recent_media6",
-                DisplayName = "recent_media6",
-                PlayedAt = new DateTime(2015, 3, 3),
-            });
-
-            recentlyPlayed.Add(new RecentlyPlayedMedia
-            {
-                MediaId = "id/recent_media7",
-                ThumbnailPath = "thumbnail/recent_media7",
-                FilePath = "filepath/recent_media7",
-                DisplayName = "recent_media8",
-                PlayedAt = new DateTime(2014, 11, 17),
-            });
-
-            return recentlyPlayed;
-        }
-    }
-}
index 47baace..47b9650 100644 (file)
@@ -17,7 +17,10 @@ using System;
 using System.Collections.Generic;
 using System.Xml.Serialization;
 using System.IO;
+
 using LibTVRefCommonPortable.DataModels;
+
+using Xamarin.Forms;
 using System.Threading.Tasks;
 using System.Diagnostics;
 
@@ -36,7 +39,7 @@ namespace LibTVRefCommonPortable.Utils
         /// <summary>
         /// A file system watcher which checks if the targeted storage is changed.
         /// </summary>
-        private static IFileSystemWatcherAPIs fileSystemWatcher = FileSystemUtils.Instance.FileSysteamWatcherInstance;
+        private static IFileSystemWatcherAPIs fileSystemWatcher = DependencyService.Get<IFileSystemWatcherAPIs>();
 
         /// <summary>
         /// An instance of AppShortcutStorage.
@@ -56,7 +59,7 @@ namespace LibTVRefCommonPortable.Utils
         /// </summary>
         private AppShortcutStorage()
         {
-            StoragePath = FileSystemUtils.Instance.PlatformShareStorage + "pinned_apps_info.xml";
+            StoragePath = DependencyService.Get<IFileSystemAPIs>()?.PlatformShareStorage + "pinned_apps_info.xml";
 
             fileSystemWatcher.Run();
         }
@@ -67,7 +70,9 @@ namespace LibTVRefCommonPortable.Utils
         /// <returns>An app Shortcut list.</returns>
         public static async Task<IEnumerable<AppShortcutInfo>> Read()
         {
-            if (FileSystemUtils.Instance.IsFileExist(StoragePath) == false)
+            IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();
+
+            if (fileSystem.IsFileExist(StoragePath) == false)
             {
                 DebuggingUtils.Err("Set Default Pinned Apps" + StoragePath);
                 List<AppShortcutInfo> result = new List<AppShortcutInfo>();
@@ -77,7 +82,7 @@ namespace LibTVRefCommonPortable.Utils
 
             for (int i = 0; i < 5; i++)
             {
-                if (FileSystemUtils.Instance.IsFileReady(StoragePath))
+                if (fileSystem.IsFileReady(StoragePath))
                 {
                     break;
                 }
@@ -91,7 +96,7 @@ namespace LibTVRefCommonPortable.Utils
                 DebuggingUtils.Dbg("[" + i + "/5] Waiting for Writing" + StoragePath);
             }
 
-            using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Open))
+            using (Stream fileStream = fileSystem.OpenFile(StoragePath, UtilFileMode.Open))
             {
                 Debug.Assert(fileStream != null);
 
@@ -110,7 +115,9 @@ namespace LibTVRefCommonPortable.Utils
         /// <returns>A status of storage update.</returns>
         public static bool Write(IEnumerable<AppShortcutInfo> pinnedAppInfo)
         {
-            using (Stream fileStream = FileSystemUtils.Instance.OpenFile(StoragePath, UtilFileMode.Create))
+            IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();
+
+            using (Stream fileStream = fileSystem.OpenFile(StoragePath, UtilFileMode.Create))
             {
                 Debug.Assert(fileStream != null);
 
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();
         }
index 4ed3434..3497da7 100644 (file)
  * limitations under the License.
  */
 
-using LibTVRefCommonPortable.Stubs;
 using System;
+using System.Collections.Generic;
 using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
 using Xamarin.Forms;
 
 namespace LibTVRefCommonPortable.Utils
@@ -32,11 +35,6 @@ namespace LibTVRefCommonPortable.Utils
         private static IFileSystemAPIs fileSystemAPIs;
 
         /// <summary>
-        /// A instance of file system watcher port layer
-        /// </summary>
-        private static IFileSystemWatcherAPIs fileSystemWatcherAPIs;
-
-        /// <summary>
         /// A instance of FileSystemUtils
         /// </summary>
         private static readonly FileSystemUtils instance = new FileSystemUtils();
@@ -53,13 +51,88 @@ namespace LibTVRefCommonPortable.Utils
         }
 
         /// <summary>
-        /// A property of file system watcher instance
+        /// A unit test stub for FileSystemUtils
         /// </summary>
-        public IFileSystemWatcherAPIs FileSysteamWatcherInstance
+        private class TestStub : IFileSystemAPIs
         {
-            get
+            /// <summary>
+            /// A directory path which should be used for app data storing.
+            /// </summary>
+            public string AppDataStorage
+            {
+                get
+                {
+                    return "test_app_data_path/";
+                }
+            }
+
+            /// <summary>
+            /// A directory path which should be used for app resource storing.
+            /// </summary>
+            public string AppResourceStorage
+            {
+                get
+                {
+                    return "test_app_resource_path/";
+                }
+            }
+
+            /// <summary>
+            /// A directory path which should be used for sharing between apps.
+            /// </summary>
+            public string PlatformShareStorage
+            {
+                get
+                {
+                    return "test_platform_share_path/";
+                }
+            }
+
+            /// <summary>
+            /// A method closes the file.
+            /// </summary>
+            /// <param name="stream">A file descriptor</param>
+            public void CloseFile(Stream stream)
+            {
+            }
+
+            /// <summary>
+            /// A method flushing the stream to write remains.
+            /// </summary>
+            /// <param name="stream">A file descriptor</param>
+            public void Flush(Stream stream)
             {
-                return fileSystemWatcherAPIs;
+            }
+
+            /// <summary>
+            /// A method checks if a file existence in the file system.
+            /// </summary>
+            /// <param name="filePath">A file path</param>
+            /// <returns>An existence of the file</returns>
+            public bool IsFileExist(string filePath)
+            {
+                return true;
+            }
+
+            /// <summary>
+            /// A method checks if file is read to use.
+            /// </summary>
+            /// <param name="filePath">A file path</param>
+            /// <returns>A status of ready</returns>
+            public bool IsFileReady(string filePath)
+            {
+                return true;
+            }
+
+            /// <summary>
+            /// A method opens a file on the given mode.
+            /// </summary>
+            /// <param name="filePath">A file path</param>
+            /// <param name="mode">An opening mode</param>
+            /// <returns>A file descriptor</returns>
+            public Stream OpenFile(string filePath, UtilFileMode mode)
+            {
+                throw new NotImplementedException();
             }
         }
 
@@ -68,8 +141,7 @@ namespace LibTVRefCommonPortable.Utils
         /// </summary>
         private FileSystemUtils()
         {
-            fileSystemAPIs = new FileSystemAPITestStub();
-            fileSystemWatcherAPIs = new FileWatcherAPITestStub();
+            fileSystemAPIs = new TestStub();
 
             try
             {
@@ -77,11 +149,6 @@ namespace LibTVRefCommonPortable.Utils
                 {
                     fileSystemAPIs = DependencyService.Get<IFileSystemAPIs>();
                 }
-
-                if (DependencyService.Get<IFileSystemWatcherAPIs>() != null)
-                {
-                    fileSystemWatcherAPIs = DependencyService.Get<IFileSystemWatcherAPIs>();
-                }
             }
             catch (InvalidOperationException e)
             {
index c8521b9..b8ee51c 100755 (executable)
@@ -51,7 +51,7 @@ namespace LibTVRefCommonPortable.Utils
         public String IconPath;
 
         /// <summary>
-        /// A last launched date
+        /// A last launched data
         /// </summary>
         public DateTime LaunchedTime;
 
@@ -67,32 +67,6 @@ namespace LibTVRefCommonPortable.Utils
     }
 
     /// <summary>
-    /// A class to store installed app information.
-    /// </summary>
-    public class InstalledApp
-    {
-        /// <summary>
-        /// An app ID
-        /// </summary>
-        public String AppID;
-
-        /// <summary>
-        /// An app label
-        /// </summary>
-        public String Applabel;
-
-        /// <summary>
-        /// An app icon path
-        /// </summary>
-        public String IconPath;
-
-        /// <summary>
-        /// A installed date
-        /// </summary>
-        public DateTime InstalledTime;
-    }
-
-    /// <summary>
     /// An interface for Application Manager feature
     /// </summary>
     public interface IApplicationManagerAPIs
@@ -101,7 +75,7 @@ namespace LibTVRefCommonPortable.Utils
         /// A method provides installed application list.
         /// </summary>
         /// <returns>An installed application list</returns>
-        Task<IEnumerable<InstalledApp>> GetAllInstalledApplication();
+        Task<Dictionary<string, string[]>> GetAllInstalledApplication();
 
         /// <summary>
         /// A method provides a recent application list.
@@ -114,7 +88,7 @@ namespace LibTVRefCommonPortable.Utils
         /// </summary>
         /// <param name="applicationId">An application ID</param>
         /// <returns>An installed application information</returns>
-        InstalledApp GetInstalledApplication(string applicationId);
+        Dictionary<string, string> GetInstalledApplication(string applicationId);
 
         /// <summary>
         /// A method for removing all recent applications
index 2f29351..edeb092 100644 (file)
  */
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
 using System.IO;
 
 namespace LibTVRefCommonPortable.Utils
index 9d56eb2..c14b051 100644 (file)
@@ -1,22 +1,8 @@
-/*
- * 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;
 using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
 using Xamarin.Forms;
 
 namespace LibTVRefCommonPortable.Utils
@@ -48,11 +34,85 @@ namespace LibTVRefCommonPortable.Utils
         }
 
         /// <summary>
+        /// A unit testing stub for MediaContentUtils
+        /// </summary>
+        private class TestStub : IMediaContentAPIs
+        {
+            public IEnumerable<RecentlyPlayedMedia> GetRecentlyPlayedMedia(int limitation)
+            {
+                IList<RecentlyPlayedMedia> recentlyPlayed = new List<RecentlyPlayedMedia>();
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media1",
+                    ThumbnailPath = "thumbnail/recent_media1",
+                    FilePath = "filepath/recent_media1",
+                    DisplayName = "recent_media1",
+                    PlayedAt = new DateTime(2017, 05, 22),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "invalid.recent_media2.nofilepath",
+                    ThumbnailPath = "invalid.recent_media2.nofilepath",
+                    DisplayName = "invalid.recent_media2.nofilepath",
+                    PlayedAt = new DateTime(2017, 2, 26),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media3.nothumbnail",
+                    FilePath = "filepath/recent_media3.nothumbnail",
+                    DisplayName = "recent_media3.nothumbnail",
+                    PlayedAt = new DateTime(2016, 4, 25),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media4",
+                    ThumbnailPath = "thumbnail/recent_media4",
+                    FilePath = "filepath/recent_media4",
+                    DisplayName = "recent_media4",
+                    PlayedAt = new DateTime(2015, 12, 7),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media5",
+                    ThumbnailPath = "thumbnail/recent_media5",
+                    FilePath = "filepath/recent_media5",
+                    DisplayName = "recent_media5",
+                    PlayedAt = new DateTime(2015, 10, 1),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media6",
+                    ThumbnailPath = "thumbnail/recent_media6",
+                    FilePath = "filepath/recent_media6",
+                    DisplayName = "recent_media6",
+                    PlayedAt = new DateTime(2015, 3, 3),
+                });
+
+                recentlyPlayed.Add(new RecentlyPlayedMedia
+                {
+                    MediaId = "id/recent_media7",
+                    ThumbnailPath = "thumbnail/recent_media7",
+                    FilePath = "filepath/recent_media7",
+                    DisplayName = "recent_media8",
+                    PlayedAt = new DateTime(2014, 11, 17),
+                });
+
+                return recentlyPlayed;
+            }
+        }
+
+        /// <summary>
         /// A Constructor
         /// </summary>
         private MediaContentUtils()
         {
-            mediaContentAPIs = new MediaContentAPITestStub();
+            mediaContentAPIs = new TestStub();
 
             try
             {
index ec7c8d8..9e5cb9b 100755 (executable)
@@ -129,9 +129,9 @@ namespace LibTVRefCommonTizen.Ports
         /// </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)
         {
-            InstalledApp result = null;
+            Dictionary<string, string> result = null;
             ApplicationInfo appInfo = null;
 
             try
@@ -143,12 +143,10 @@ namespace LibTVRefCommonTizen.Ports
                     return null;
                 }
 
-                result = new InstalledApp()
-                {
-                    AppID = appInfo.ApplicationId,
-                    Applabel = appInfo.Label,
-                    IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon,
-                };
+                result = new Dictionary<string, string>();
+                result.Add("Label", appInfo.Label);
+                result.Add("ApplicationId", appInfo.ApplicationId);
+                result.Add("IconPath", (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon);
             }
             catch (Exception exception)
             {
@@ -163,12 +161,13 @@ namespace LibTVRefCommonTizen.Ports
         /// Gets the information of the installed applications asynchronously
         /// </summary>
         /// <returns>The list of the installed applications</returns>
-        public async Task<IEnumerable<InstalledApp>> GetAllInstalledApplication()
+        public async Task<Dictionary<string, string[]>> GetAllInstalledApplication()
         {
             try
             {
-                IList<InstalledApp> resultList = new List<InstalledApp>();
+                Dictionary<string, string[]> resultList = new Dictionary<string, string[]>();
                 Task<IEnumerable<ApplicationInfo>> task = ApplicationManager.GetInstalledApplicationsAsync();
+                string[] result;
 
                 IEnumerable<ApplicationInfo> installedList = await task;
 
@@ -192,13 +191,13 @@ namespace LibTVRefCommonTizen.Ports
                         continue;
                     }
 
-                    resultList.Add(new InstalledApp
-                    {
-                        AppID = appInfo.ApplicationId,
-                        Applabel = appInfo.Label,
-                        IconPath = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon,
-                        InstalledTime = new DateTime(pkgInfo.InstalledTime),
-                    });
+                    result = new string[4];
+
+                    result[0] = appInfo.Label;
+                    result[1] = appInfo.ApplicationId;
+                    result[2] = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon;
+                    result[3] = "" + pkgInfo.InstalledTime;
+                    resultList.Add(appInfo.ApplicationId, result);
                 }
 
                 return resultList;
index 54b33c8..68acc45 100755 (executable)
@@ -246,13 +246,6 @@ namespace TVApps.ViewModels
             }
             else
             {
-                if (PinnedApps.Count >= 10)
-                {
-                    IsSelectedExceeds = true;
-                    ViewModel.OnPropertyChanged("IsSelectedExceeds");
-                    return;
-                }
-
                 DebuggingUtils.Dbg("Pin : " + appID);
                 SelectedApp.IsPinned = true;
                 PinnedApps.Add(appID, appID);
@@ -293,7 +286,7 @@ namespace TVApps.ViewModels
 
         /// <summary>
         /// A method for checking the application is removable
-        /// If the application is removable, show Delete Pop-up
+        /// If the application is removable, show Delete Popup
         /// </summary>
         /// <param name="appID">The ID of application for checking</param>
         public void CheckDeleteApp(string appID)
@@ -306,8 +299,11 @@ namespace TVApps.ViewModels
                 return;
             }
 
-            string appLabel = ApplicationManagerUtils.Instance.GetInstalledApplication(appID).Applabel;
-            ViewModel.ShowDeletePopup(appLabel);
+            string appLabel = null;
+            if (ApplicationManagerUtils.Instance.GetInstalledApplication(appID).TryGetValue("Label", out appLabel))
+            {
+                ViewModel.ShowDeletePopup(appLabel);
+            }
         }
 
         /// <summary>