public void ClockDataCollectionTest_Equals() { // Arrange var f = new MainForm(); var td1 = new TimerData(f.MyDataFile, f.MultiAudioPlayer) { Tag = "t1", GroupName = "test", CurrentTimeSpan = TimeSpan.FromMinutes(60) }; var td2 = new TimerData(f.MyDataFile, f.MultiAudioPlayer) { Tag = "t2", CurrentTimeSpan = TimeSpan.FromMinutes(50) }; var td3 = new TimerData(f.MyDataFile, f.MultiAudioPlayer) { Tag = "t3", CurrentTimeSpan = TimeSpan.FromMinutes(20) }; var ad4 = new AlarmData(f.MyDataFile, f.MultiAudioPlayer) { Tag = "a4", CurrentDateTime = DateTime.Now + TimeSpan.FromMinutes(40) }; var ad5 = new AlarmData(f.MyDataFile, f.MultiAudioPlayer) { Tag = "a5", CurrentDateTime = DateTime.Now + TimeSpan.FromMinutes(1000) }; // Act f.MyDataFile.ClockMCollection.IsUnsavedLocked = true; f.MyDataFile.ClockMCollection.AddClocks(td1, td2, td3, ad4, ad5); f.MyDataFile.ClockMCollection.IsUnsavedLocked = false; var cc = new ClockMCollection(f.MyDataFile); cc.Groups = f.MyDataFile.ClockMCollection.Groups; cc.AddClocks(td1, td2, td3, ad4, ad5); Assert.AreEqual(f.MyDataFile.ClockMCollection, cc); cc.RemoveAllClocks(); cc.Groups = f.MyDataFile.ClockMCollection.Groups; cc.AddClocks(td2, td1, td3, ad4, ad5); Assert.AreNotEqual(f.MyDataFile.ClockMCollection, cc); }
public void ClockDataCollectionTest_ClockSatisfiesFilter() { // Arrange var f = new MainForm(); var c0 = new TimerData(f.MyDataFile, f.MultiAudioPlayer) { GroupName = "" }; var cTest = new AlarmData(f.MyDataFile, f.MultiAudioPlayer) { GroupName = "test" }; // Act f.MyDataFile.ClockMCollection.AddClocks(c0, cTest); var f1 = new FilterM(f.MyDataFile.ClockMCollection, ""); Assert.IsFalse(f1.Autocorrected); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f1, c0)); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f1, cTest)); var f2 = new FilterM(f.MyDataFile.ClockMCollection, "1"); Assert.IsFalse(f2.Autocorrected); Assert.IsFalse(ClockMCollection.ClockSatisfiesFilter(f2, c0)); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f2, cTest)); var f3 = new FilterM(f.MyDataFile.ClockMCollection, "alarms"); Assert.IsFalse(f3.Autocorrected); Assert.IsFalse(ClockMCollection.ClockSatisfiesFilter(f3, c0)); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f3, cTest)); var f4 = new FilterM(f.MyDataFile.ClockMCollection, "2"); Assert.IsTrue(f4.Autocorrected); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f4, c0)); Assert.IsTrue(ClockMCollection.ClockSatisfiesFilter(f4, cTest)); }