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

Allow naming of mocks #74

Closed
pimterry opened this issue Dec 18, 2013 · 1 comment · Fixed by #76
Closed

Allow naming of mocks #74

pimterry opened this issue Dec 18, 2013 · 1 comment · Fixed by #76

Comments

@pimterry
Copy link
Contributor

Maybe this is a feature already, but I can't see it anywhere.

Fairly often I end up trying to debug error messages like:

Expected: equivalent to < <Castle.Proxies.IWeekTimePeriodProxy>, <Castle.Proxies.IWeekTimePeriodProxy>, <Castle.Proxies.IWeekTimePeriodProxy> >
  But was:  < <Castle.Proxies.IWeekTimePeriodProxy>, <Castle.Proxies.IWeekTimePeriodProxy> >

This would be much easier to do if you could give your mocks a name, which could then be used in a ToString override, so you can easily track which one has ended up where (new Mock<X>("name") or new Mock<X>().WithName("name") would be fine).

I'd be happy to take a look at this, if it was likely to be accepted. Does it sound like something you'd be happy to add?

@kzu
Copy link
Member

kzu commented Dec 18, 2013

Yes, this is likely to be accepted. It's not the first time we have such a request.

I'd just make it a property, like Mock.Name = "Foo";

@kzu kzu closed this as completed in #76 Jan 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants