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.
18 using Microsoft.VisualStudio.TestTools.UnitTesting;
19 using LibTVRefCommonPortable.Models;
20 using LibTVRefCommonPortable.DataModels;
23 namespace HomeUnitTest
26 /// A test cases for RecentShortcutController
29 public class RecentTestCases
32 /// A instance of RecentShortcutController
34 private RecentShortcutController controller;
37 /// A constructor that initializes RecentShortcutController instance.
39 public RecentTestCases()
41 controller = new RecentShortcutController();
45 public void RecentGetListTest()
47 var recents = controller.GetList();
49 // R : MAX number of recent = 10
50 if (recents.Count() > 10)
52 Assert.Fail("Too many Recent!!!, Returned = " + recents.Count());
55 bool isAllMedias = true;
56 bool isAllApps = true;
58 foreach (var recent in recents)
60 Console.Out.WriteLine("-----------------------------");
61 Console.Out.WriteLine("Type : " + recent.Type);
62 Console.Out.WriteLine("ID : " + recent.Id);
63 Console.Out.WriteLine("Date : " + recent.Date);
64 Console.Out.WriteLine("ScreenShot : " + recent.ScreenshotPath);
68 case RecentShortcutType.Application:
71 case RecentShortcutType.Media:
76 // R : Invalid Recent(id, label has 'invalid') should not included!!!
77 if (recent.CurrentStateDescription == null ||
78 recent.CurrentStateDescription.Label.ToLower().Contains("invalid"))
80 Assert.Fail("Recent including invalid items!!!, " + recent.Id);
84 // R : Test Sample Recent is consist of App and Media types.
85 if (isAllMedias || isAllApps)
87 Assert.Fail("Invalid Recent list, All Media({0}), All Apps({1})", isAllMedias, isAllApps);