Skip to content

Commit 1fc4856

Browse files
authored
Changed TypeNotMockable exception message (#1116)
1 parent f2aa090 commit 1fc4856

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Moq/Guard.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ public static void IsMockable(Type type)
204204
{
205205
if (!type.IsMockable())
206206
{
207-
throw new NotSupportedException(Resources.TypeNotMockable);
207+
throw new NotSupportedException(
208+
string.Format(
209+
Resources.TypeNotMockable,
210+
type.GetFormattedName()));
208211
}
209212
}
210213

src/Moq/Properties/Resources.Designer.cs

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Moq/Properties/Resources.resx

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<value>Expression {0} involves a field access, which is not supported. Use properties instead.</value>
122122
</data>
123123
<data name="TypeNotMockable" xml:space="preserve">
124-
<value>Type to mock must be an interface, a delegate, or a non-sealed, non-static class.</value>
124+
<value>Type to mock ({0}) must be an interface, a delegate, or a non-sealed, non-static class.</value>
125125
</data>
126126
<data name="MockExceptionMessage" xml:space="preserve">
127127
<value>{0} invocation failed with mock behavior {1}.
@@ -354,4 +354,4 @@ This could be caused by an unrecognized type conversion, coercion, narrowing, or
354354
<data name="ConditionalSetupsAreNotVerifiable" xml:space="preserve">
355355
<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>
356356
</data>
357-
</root>
357+
</root>

0 commit comments

Comments
 (0)