Skip to content

Commit 28f4677

Browse files
committed
modified used MockException as failure criteria
1 parent 49628f3 commit 28f4677

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

RubberduckTests/Refactoring/RenameTests.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,8 @@ public void RenameRefactoring_RenameSub_Issue2727()
6969
//To see if he wants to continue with the Renaming process.
7070
//To pass this test, FindDeclarationForIdentifier() should find zero collisions and therefore
7171
//skips the logic that presents the message box to the user.
72-
bool msgboxShowWasInvoked = true; // == failing condition
73-
try
74-
{
75-
//Throws an exception if Show() was NOT called => this is the successful behavior
76-
msgbox.Verify(m => m.Show(It.IsAny<string>(), It.IsAny<string>(), MessageBoxButtons.YesNo, It.IsAny<MessageBoxIcon>()));
77-
msgboxShowWasInvoked = true; //this line executed if the MessageBox is presented to the user
78-
}
79-
catch (MockException)
80-
{
81-
msgboxShowWasInvoked = false;
82-
}
83-
catch
84-
{
85-
throw;
86-
}
87-
Assert.IsFalse(msgboxShowWasInvoked, "RenameRefactoring found a conflicting declaration where none exists.");
72+
string failMsg = "RenameRefactoring found a conflicting declaration where none exists.";
73+
msgbox.Verify(m => m.Show(It.IsAny<string>(), It.IsAny<string>(), MessageBoxButtons.YesNo, It.IsAny<MessageBoxIcon>()), Times.Never, failMsg);
8874
}
8975

9076

0 commit comments

Comments
 (0)