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 public class RecentTesting
28 public RecentTesting()
34 public void GetListTest()
36 RecentShortcutController recentShortcutController = new RecentShortcutController();
38 var recents = recentShortcutController.GetList();
40 // MAX number of recent = 10
41 if (recents.Count() > 10)
43 Assert.Fail("Too many Recent!!!, Returned = " + recents.Count());
46 bool isAllMedias = true;
47 bool isAllApps = true;
49 foreach (var recent in recents)
51 Console.Out.WriteLine("-----------------------------");
52 Console.Out.WriteLine("Type : " + recent.Type);
53 Console.Out.WriteLine("ID : " + recent.Id);
54 Console.Out.WriteLine("Date : " + recent.Date);
55 Console.Out.WriteLine("ScreenShot : " + recent.ScreenshotPath);
59 case RecentShortcutType.Application:
62 case RecentShortcutType.Media:
67 // Invalid Recent(id, label has 'invalid') should not included!!!
68 if (recent.CurrentStateDescription == null ||
69 recent.CurrentStateDescription.Label.ToLower().Contains("invalid"))
71 Assert.Fail("Recent including invalid items!!!, " + recent.Id);
75 // Test Sample Recent is consist of App and Media types.
76 if (isAllMedias || isAllApps)
78 Assert.Fail("Invalid Recent list, All Media({0}), All Apps({1})", isAllMedias, isAllApps);