0

How to raise CancelEventArgs in unit testing using C#

void OnCloseWindow(object sender, CancelEventArgs e)
        {
            var window = base.DataContext as IWindowManagerService;
            if (window != null)
            {
                e.Cancel = !window.CloseWindow();
            }
        }
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
pavi
  • 1
  • 2
  • unit testing is for code files not gui's, so you should have your close event calling a method, you would then test the method – MikeT Apr 18 '17 at 09:16
  • Wrong duplicate... this is about raising the event and not about testing an event that is expected to be fired from somewhere else. – grek40 Apr 18 '17 at 12:28

0 Answers0