public async Task WhenDoubleClickAwayDialogCloses() { _dialogHost.CloseOnClickAway = true; Grid contentCover = _dialogHost.FindVisualChild <Grid>(DialogHost.ContentCoverGridName); int closingCount = 0; Task shownDialog = _dialogHost.ShowDialog("Content", new DialogClosingEventHandler((sender, args) => { closingCount++; })); contentCover.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, 1, MouseButton.Left) { RoutedEvent = UIElement.MouseLeftButtonUpEvent }); contentCover.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, 1, MouseButton.Left) { RoutedEvent = UIElement.MouseLeftButtonUpEvent }); await shownDialog; Assert.Equal(1, closingCount); }