Skip to content

Changed TypeNotMockable exception message #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Moq/Guard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ public static void IsMockable(Type type)
{
if (!type.IsMockable())
{
throw new NotSupportedException(Resources.TypeNotMockable);
throw new NotSupportedException(
string.Format(
Resources.TypeNotMockable,
type.GetFormattedName()));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Moq/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Moq/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<value>Expression {0} involves a field access, which is not supported. Use properties instead.</value>
</data>
<data name="TypeNotMockable" xml:space="preserve">
<value>Type to mock must be an interface, a delegate, or a non-sealed, non-static class.</value>
<value>Type to mock ({0}) must be an interface, a delegate, or a non-sealed, non-static class.</value>
</data>
<data name="MockExceptionMessage" xml:space="preserve">
<value>{0} invocation failed with mock behavior {1}.
Expand Down Expand Up @@ -354,4 +354,4 @@ This could be caused by an unrecognized type conversion, coercion, narrowing, or
<data name="ConditionalSetupsAreNotVerifiable" xml:space="preserve">
<value>This call to 'Verifiable' will have no effect because conditional setups are ignored by both 'Verify' and 'VerifyAll'. This might indicate an error in your code.</value>
</data>
</root>
</root>