internal static IMRUListViewModel CreateTestData() { var retList = MRU_Service.Create_List(); var now = DateTime.Now; retList.UpdateEntry(MRU_Service.Create_Entry(@"C:tmp\t0_now.txt", false)); // This should be shown yesterday if update and grouping work correctly retList.UpdateEntry(MRU_Service.Create_Entry(@"C:tmp\t15_yesterday.txt", now.Add(new TimeSpan(-20, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:\tmp\t15_yesterday.txt", now.Add(new TimeSpan(-1, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"f:tmp\t1_today.txt", now.Add(new TimeSpan(-1, 0, 0, 0)), true)); retList.UpdateEntry(MRU_Service.Create_Entry(@"f:tmp\Readme.txt", now.Add(new TimeSpan(-1, 0, 0, 0)), true)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t2_today.txt", now.Add(new TimeSpan(0, -1, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t3_today.txt", now.Add(new TimeSpan(0, -10, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t4_today.txt", now.Add(new TimeSpan(0, 0, -1, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t5_today.txt", now.Add(new TimeSpan(0, -20, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t5_today.txt", now.Add(new TimeSpan(0, -20, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\t6_today.txt", now.Add(new TimeSpan(0, -44, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t7_today.txt", now.Add(new TimeSpan(-30, 0, 0, 0)), true)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t8_today.txt", now.Add(new TimeSpan(-25, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t9_today.txt", now.Add(new TimeSpan(-20, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t10_today.txt", now.Add(new TimeSpan(-10, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t11_today.txt", now.Add(new TimeSpan(-5, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t12_today.txt", now.Add(new TimeSpan(-4, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t13_today.txt", now.Add(new TimeSpan(-3, 0, 0, 0)), false)); retList.UpdateEntry(MRU_Service.Create_Entry(@"c:tmp\directory1\directory2\directory3\t14_today.txt", now.Add(new TimeSpan(-2, 0, 0, 0)), false)); return(retList); }
public void TestEqual() { var testColl = GenerateTestData.CreateTestData(); var testColl1 = GenerateTestData.CreateTestData(); Assert.IsTrue(testColl.Equals(testColl1)); testColl = MRU_Service.Create_List(); Assert.IsFalse(testColl.Equals(testColl1)); }
/// <summary> /// Initializes a new instance of the <see cref="AppModel"/> class. /// </summary> public AppModel() { string dirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MSI Viewer"); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string persistPath = Path.Combine(dirPath, "mru.dat"); try { MRUModel = MRUEntrySerializer.Load(persistPath); } catch (FileNotFoundException) { MRUModel = MRU_Service.Create_List(); } }