From: ChulSeung Kim Date: Mon, 5 Jun 2017 07:27:18 +0000 (+0900) Subject: Add unit test case for RecentShortcutController. X-Git-Tag: submit/tizen/20170808.015446~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b75d1fd65ffa45a63398fe401157504e035d5085;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Add unit test case for RecentShortcutController. Remove meaningless TODOs Change-Id: I157ddce45ede7ac4967add7ba95e4c9986917e4f --- diff --git a/HomeUnitTest/HomeUnitTest.csproj b/HomeUnitTest/HomeUnitTest.csproj new file mode 100644 index 0000000..7bf1694 --- /dev/null +++ b/HomeUnitTest/HomeUnitTest.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {1F2DB8A0-7D1E-4BA3-BF27-335D033C572C} + Library + Properties + HomeUnitTest + HomeUnitTest + v4.6.1 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + TRACE;DEBUG;_TEST_ + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll + + + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll + + + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll + + + + + + + + + {67f9d3a8-f71e-4428-913f-c37ae82cdb24} + LibTVRefCommonPortable + + + + + + + + + + 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다. + + + + + + + + \ No newline at end of file diff --git a/HomeUnitTest/Properties/AssemblyInfo.cs b/HomeUnitTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..695ffc8 --- /dev/null +++ b/HomeUnitTest/Properties/AssemblyInfo.cs @@ -0,0 +1,21 @@ +// +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("HomeUnitTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HomeUnitTest")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("1f2db8a0-7d1e-4ba3-bf27-335d033c572c")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HomeUnitTest/RecentTesting.cs b/HomeUnitTest/RecentTesting.cs new file mode 100644 index 0000000..50f90b0 --- /dev/null +++ b/HomeUnitTest/RecentTesting.cs @@ -0,0 +1,82 @@ +/* + * 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 LibTVRefCommonPortable.DataModels; +using System.Linq; + +namespace HomeUnitTest +{ + [TestClass] + public class RecentTesting + { + public RecentTesting() + { + + } + + [TestMethod] + public void GetListTest() + { + RecentShortcutController recentShortcutController = new RecentShortcutController(); + + var recents = recentShortcutController.GetList(); + + // MAX number of recent = 10 + if (recents.Count() > 10) + { + Assert.Fail("Too many Recent!!!, Returned = " + recents.Count()); + } + + bool isAllMedias = true; + bool isAllApps = true; + + foreach (var recent in recents) + { + Console.Out.WriteLine("-----------------------------"); + Console.Out.WriteLine("Type : " + recent.Type); + Console.Out.WriteLine("ID : " + recent.Id); + Console.Out.WriteLine("Date : " + recent.Date); + Console.Out.WriteLine("ScreenShot : " + recent.ScreenshotPath); + + switch (recent.Type) + { + case RecentShortcutType.Application: + isAllMedias = false; + break; + case RecentShortcutType.Media: + isAllApps = false; + break; + } + + // Invalid Recent(id, label has 'invalid') should not included!!! + if (recent.CurrentStateDescription == null || + recent.CurrentStateDescription.Label.ToLower().Contains("invalid")) + { + Assert.Fail("Recent including invalid items!!!, " + recent.Id); + } + } + + // 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); + } + } + } +} diff --git a/HomeUnitTest/Settings.StyleCop b/HomeUnitTest/Settings.StyleCop new file mode 100644 index 0000000..837530c --- /dev/null +++ b/HomeUnitTest/Settings.StyleCop @@ -0,0 +1,722 @@ + + + NoMerge + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/HomeUnitTest/packages.config b/HomeUnitTest/packages.config new file mode 100644 index 0000000..dab081a --- /dev/null +++ b/HomeUnitTest/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LibTVRefCommonPortable/DataModels/CommandAction.cs b/LibTVRefCommonPortable/DataModels/CommandAction.cs index 8ad9efa..40585c9 100644 --- a/LibTVRefCommonPortable/DataModels/CommandAction.cs +++ b/LibTVRefCommonPortable/DataModels/CommandAction.cs @@ -14,7 +14,9 @@ * limitations under the License. */ +using System; using System.Windows.Input; +using Xamarin.Forms; namespace LibTVRefCommonPortable.DataModels { @@ -29,9 +31,9 @@ namespace LibTVRefCommonPortable.DataModels public string NextStateDescription { get; set; } /// - /// A Command. + /// A Command to be executed /// - public ICommand Command { get; set; } + public event EventHandler Command; /// /// A Command parameter. @@ -44,7 +46,7 @@ namespace LibTVRefCommonPortable.DataModels /// A next statue of a Shortcut. public string Execute() { - Command.Execute(CommandParameter); + Command?.Invoke(this, CommandParameter); return NextStateDescription; } } diff --git a/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs b/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs index b110f36..00854f6 100644 --- a/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs +++ b/LibTVRefCommonPortable/DataModels/ShortcutInfo.cs @@ -87,16 +87,6 @@ namespace LibTVRefCommonPortable.DataModels return true; } - // TODO : remove, for debugging purpose - foreach (var item in stateDescriptions) - { - if (item.Value.Equals(CurrentStateDescription)) - { - //DebuggingUtils.Dbg("[" + item.Key + "] => [" + state + "]"); - break; - } - } - CurrentStateDescription = stateDescriptions[state]; OnPropertyChanged("CurrentStateDescription"); return true; diff --git a/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj b/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj index 52a8703..f59578f 100755 --- a/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj +++ b/LibTVRefCommonPortable/LibTVRefCommonPortable.csproj @@ -54,8 +54,10 @@ + + @@ -75,32 +77,28 @@ - ..\packages\Tizen.Xamarin.Forms.Extension.2.3.5-r233-002\lib\portable-win+net45+wp80+win81+wpa81\Tizen.Xamarin.Forms.Extension.dll - True + ..\packages\Tizen.Xamarin.Forms.Extension.2.3.5-r233-003\lib\portable-win+net45+wp80+win81+wpa81\Tizen.Xamarin.Forms.Extension.dll - ..\packages\Xamarin.Forms.2.3.5-r233-003\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll - True + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll - ..\packages\Xamarin.Forms.2.3.5-r233-003\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll - True + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll - ..\packages\Xamarin.Forms.2.3.5-r233-003\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll - True + ..\packages\Xamarin.Forms.2.3.5-r233-008\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll - + 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다. - +