public void BasicResolutionChangedHandlingTest() { var testScreen = new TestScreen { bounds = new Rect(0, 0, 1000, 500) }; var notifier = new CustomNotifier(testScreen); notifier.UpdatePositioner(NotificationPosition.BottomRight, 2); var toasts = Enumerable.Range(0, 3).Select(_ => new CustomNotification(null, notifier)).ToList(); var tasks = toasts.Select(toast => notifier.ShowAsync(toast, 1)).ToList(); var pos = CustomNotifier.positioner; var ps = pos.Items.Select(i => pos.GetItemPosition(i)).ToList(); Assert.AreEqual(new Point(615, 390), ps[0]); Assert.AreEqual(new Point(615, 290), ps[1]); testScreen.bounds = new Rect(0, 0, 800, 600); testScreen.Changed(); pos = CustomNotifier.positioner; ps = pos.Items.Select(i => pos.GetItemPosition(i)).ToList(); Assert.AreEqual(new Point(415, 490), ps[0]); Assert.AreEqual(new Point(415, 390), ps[1]); tasks.ToList().ForEach(WaitWithDispatcher); tasks.ToList().ForEach(t => Assert.AreEqual(NotificationResult.TimedOut, t.Result)); }
public void ResolutionChangingTest() { var testScreen = new TestScreen { bounds = new Rect(0, 0, 1000, 500) }; var notifier = new CustomNotifier(testScreen); notifier.UpdatePositioner(NotificationPosition.BottomRight, 2); var toasts = Enumerable.Range(0, 3).Select(_ => new CustomNotification(null, notifier)).ToList(); var tasks = toasts.Select(toast => notifier.ShowAsync(toast, 1)).ToList(); Assert.AreEqual(2, CustomNotifier.positioner.Items.Count(i => i != null)); testScreen.bounds = new Rect(0, 0, 800, 600); testScreen.Changed(); Assert.AreEqual(2, CustomNotifier.positioner.Items.Count(i => i != null)); tasks.ToList().ForEach(WaitWithDispatcher); }
public void ResolutionChangingTest() { var testScreen = new TestScreen { bounds = new System.Drawing.Rectangle(0, 0, 1000, 500) }; var notifier = new CustomNotifier(testScreen); notifier.UpdatePositioner(NotificationPosition.BottomRight, 2); var toasts = Enumerable.Range(0, 3).Select(_ => new CustomNotification(null, notifier)).ToList(); var tasks = toasts.Select(toast => notifier.ShowAsync(toast, 1)).ToList(); Assert.AreEqual(2, CustomNotifier.positioner.Items.Count(i => i != null)); testScreen.bounds = new System.Drawing.Rectangle(0, 0, 800, 600); testScreen.Changed(); Assert.AreEqual(2, CustomNotifier.positioner.Items.Count(i => i != null)); tasks.ToList().ForEach(WaitWithDispatcher); }
public void BasicResolutionChangedHandlingTest() { var testScreen = new TestScreen { bounds = new System.Drawing.Rectangle(0, 0, 1000, 500) }; var notifier = new CustomNotifier(testScreen); notifier.UpdatePositioner(NotificationPosition.BottomRight, 2); var toasts = Enumerable.Range(0, 3).Select(_ => new CustomNotification(null, notifier)).ToList(); var tasks = toasts.Select(toast => notifier.ShowAsync(toast, 1)).ToList(); var pos = CustomNotifier.positioner; var ps = pos.Items.Select(i => pos.GetItemPosition(i)).ToList(); Assert.AreEqual(new Point(615, 390), ps[0]); Assert.AreEqual(new Point(615, 290), ps[1]); testScreen.bounds = new System.Drawing.Rectangle(0, 0, 800, 600); testScreen.Changed(); pos = CustomNotifier.positioner; ps = pos.Items.Select(i => pos.GetItemPosition(i)).ToList(); Assert.AreEqual(new Point(415, 490), ps[0]); Assert.AreEqual(new Point(415, 390), ps[1]); tasks.ToList().ForEach(WaitWithDispatcher); tasks.ToList().ForEach(t => Assert.AreEqual(NotificationResult.TimedOut, t.Result)); }