public void FireTrackingStoppedOnRestartTest() { var tracker = new HoverTracker(); var ctrl = new Button(); var wnd = new Popup(new Button()); var eventCatcher = new EventCatcher(); tracker.TrackingStopped += eventCatcher.OnTrackingStopped; tracker.Start(ctrl, wnd); Assert.AreEqual(0, eventCatcher.Fired); tracker.Start(ctrl, wnd); Assert.AreEqual(1, eventCatcher.Fired); Assert.IsTrue(tracker.Tracking); }
public void AutoStopOnControlDisposedTest() { var tracker = new HoverTracker(); var ctrl = new Button(); var wnd = new Popup(new Button()); tracker.Start(ctrl, wnd); Assert.IsTrue(tracker.Tracking); ctrl.Dispose(); Thread.Sleep(200); Application.DoEvents(); // force timer event processing Assert.IsFalse(tracker.Tracking); Assert.IsNull(tracker.Control); Assert.IsNull(tracker.Popup); }
public void CommonTrackingTest() { var tracker = new HoverTracker(); var ctrl = new Button(); var wnd = new Popup(new Button()); Assert.IsFalse(tracker.Tracking); tracker.Start(ctrl, wnd); Assert.IsTrue(tracker.Tracking); Assert.AreEqual(ctrl, tracker.Control); Assert.AreEqual(wnd, tracker.Popup); tracker.Stop(); Assert.IsFalse(tracker.Tracking); Assert.IsNull(tracker.Control); Assert.IsNull(tracker.Popup); }
public void FireTrackingStoppedOnStopTest() { var tracker = new HoverTracker(); var ctrl = new Button(); var wnd = new Popup(new Button()); var eventCatcher = new EventCatcher(); tracker.TrackingStopped += eventCatcher.OnTrackingStopped; tracker.Start(ctrl, wnd); Assert.AreEqual(0, eventCatcher.Fired); tracker.Stop(); Assert.AreEqual(1, eventCatcher.Fired); Assert.IsNotNull(eventCatcher.Ev); Assert.AreEqual(ctrl, eventCatcher.Ev.Control); Assert.AreEqual(wnd, eventCatcher.Ev.Popup); }
public void StartWrongArgTest() { var tracker = new HoverTracker(); tracker.Start(null, null); }
public void StartWrongArg2Test() { var tracker = new HoverTracker(); tracker.Start(new Button(), null); }