public void ClockGroupCollectionTest_Move() { var mf = new MainForm(); var df = mf.MyDataFile; var d = new ClockVMCollection.Model(df); ClockGroupMCollection c = d.Groups; d.AppliedFilter = new FilterM(d); var cl = new TimerData(df, mf.MultiAudioPlayer) { GroupName = "g1" }; d.AddClock(cl); c.Add("g2"); c.Add("g3"); c.Move("g1", 2); Assert.AreEqual(c.GroupNames[0], "g2"); Assert.AreEqual(c.GroupNames[1], "g3"); Assert.AreEqual(c.GroupNames[2], "g1"); }
public void ClockGroupCollectionTest_Add() { var mf = new MainForm(); var df = mf.MyDataFile; var d = new ClockVMCollection.Model(df); ClockGroupMCollection c = d.Groups; Assert.IsTrue(c.Add("g1")); Assert.IsFalse(c.Add("g1")); Assert.IsTrue(c.Contains("g1")); Assert.IsTrue(d.IsUnsaved); }
public void ClockGroupCollectionTest_Equals() { var mf = new MainForm(); var df = mf.MyDataFile; var d = new ClockVMCollection.Model(df); ClockGroupMCollection c = d.Groups; var cc = new ClockGroupMCollection(d); d.AppliedFilter = new FilterM(d); // Act c.Add("a"); c.Add("b"); c.Add("c"); cc.Add("a"); cc.Add("b"); cc.Add("c"); Assert.IsTrue(c.Equals(cc)); Bitmap bmp = SystemIcons.Asterisk.ToBitmap(); c.SetIcon("b", bmp); // SetIcon creates a new image from the given image cc.SetIcon("b", bmp); Assert.IsFalse(c.Equals(cc)); c.RemoveIcon("b"); cc.RemoveIcon("b"); Assert.IsTrue(c.Equals(cc)); cc.Move("b", 2); Assert.IsTrue(!c.Equals(cc)); }
public void ClockGroupCollectionTest_Contains() { var mf = new MainForm(); var df = mf.MyDataFile; var d = new ClockVMCollection.Model(df); ClockGroupMCollection c = d.Groups; d.AppliedFilter = new FilterM(d); var cl = new TimerData(df, mf.MultiAudioPlayer) { GroupName = "g1" }; d.AddClock(cl); Assert.IsFalse(c.Add("g1")); Assert.IsTrue(c.Contains("g1")); Assert.IsFalse(c.Contains("g2")); Assert.AreEqual(1, c.Count); }
public void ClockGroupCollectionTest_ClearWithoutChangingClocks() { var mf = new MainForm(); var df = mf.MyDataFile; var d = new ClockVMCollection.Model(df); ClockGroupMCollection c = d.Groups; d.AppliedFilter = new FilterM(d); var cl = new TimerData(df, mf.MultiAudioPlayer) { GroupName = "g1" }; d.AddClock(cl); Assert.IsFalse(c.Add("g1")); Assert.IsTrue(c.ClearWithoutChangingClocks()); Assert.AreEqual(0, c.Count); Assert.AreEqual("g1", cl.GroupName); Assert.IsTrue(d.IsUnsaved); }