Skip to content
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

TypeNotMockable Exception #1112

Closed
Sergeir1 opened this issue Dec 1, 2020 · 1 comment · Fixed by #1116
Closed

TypeNotMockable Exception #1112

Sergeir1 opened this issue Dec 1, 2020 · 1 comment · Fixed by #1116
Milestone

Comments

@Sergeir1
Copy link

Sergeir1 commented Dec 1, 2020

Can the Moq Gaurd class exception below also return the type name? it would be very helpful when mocking objects that take multiple constructor parameters.

	public static void IsMockable(Type type)
	{
		if (!type.IsMockable())
		{
			throw new NotSupportedException(Resources.TypeNotMockable);
		}
	}
@stakx
Copy link
Contributor

stakx commented Dec 1, 2020

Doesn't the stack trace already point at the code location where you're trying to instantiate a mock?

But yes, I suppose we could do that. Feel free to submit a PR.

@stakx stakx added this to the 4.15.3 milestone Dec 10, 2020
@stakx stakx modified the milestones: 4.15.3, 4.16.0 Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants