chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
How to create stub for ShowDialog?

 if (Isenable|| sfd.ShowDialog(this) == DialogResult.OK)
     {
                    if ((sfd != null) && FileIsInUse(sfd.FileName) )
                    {
                        MessageBox.Show(Localize.LocalMessage(\"localized_msg_Unable_Open_File\"));
                        return;
                    }
asked by gnanam (4.7k points)

1 Answer

0 votes

Hello

var sfdMock = new Mock<SaveFileDialog>();

sfdMock.Setup(dialog => dialog.ShowDialog(It.IsAny<IWin32Window>())).Returns(DialogResult.OK);

Regards
David Warner
answered by davidwarnerrr (140 points)
...