Code:
Public Async Function ShowYesNoAsync(message As String, title As String, icon As MessageBoxImage) As Task(Of Boolean) Implements IDialogService.ShowYesNoAsync
        Return Await Task.Run(Function()
                                  Dim res = MessageBox.Show(message, title, MessageBoxButton.YesNo, icon)

                                  If (res = MessageBoxResult.Yes) Then
                                      Return True
                                  Else
                                      Return False
                                  End If
                              End Function)
    End Function
Hi

I want to unit test the above method to make sure that the if statement is tested, you never know, someone might flip the true/false and cause weirdness.

I am however not sure how to do it. I have an interface IDialogService where this method is present, but there is no way to "mock" the messagebox.show() method to simulate a Yes/No response? Would it be possible with some refactoring of the method to somehow inject a fake dialogresult, since that is really all I need because that is what the if statement reacts on...

thanks
Henrik