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 for class mocks and interface mocks to mock System.Object methods #250

Merged
merged 2 commits into from
Jul 18, 2016

Conversation

kolomanschaft
Copy link

  • int object.GetHashCode()
  • bool object.Equals(object obj)
  • string object.ToString()

This fixes #248.

/// </summary>
internal class ProxyMethodHook : AllMethodsHook
{
protected static readonly Tuple<Type, string>[] GrantedMethods = new Tuple<Type, string>[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it HashSet<T> so Contains would work faster?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to this. Straightforward since Tuple already implements GetHashCode

@kzu
Copy link
Contributor

kzu commented May 25, 2016

Wouldn't mind at all if you rebased on top of master, grab EditorConfig VS extension from the VS gallery, and auto-format again to get rid of all the whitespace changes ;)

@kzu
Copy link
Contributor

kzu commented Jul 11, 2016

if the two minor fixes are implemented, I'd gladly merge this

@kolomanschaft
Copy link
Author

Very nice! I'll do it on Monday when I'm back at work.

Martin Hammerschmied added 2 commits July 18, 2016 10:29
…, `object.Equals(object obj)` and `object.GetHashCode()`.
…s. Also fixed a couple of white space errors.
@kolomanschaft
Copy link
Author

@kzu All done :-).

@kzu kzu merged commit ffcaf6e into devlooped:master Jul 18, 2016
@kzu
Copy link
Contributor

kzu commented Jul 18, 2016

Thanks! 👍

@kzu
Copy link
Contributor

kzu commented Aug 8, 2016

Heya @kolomanschaft, would you mind looking at the side effect of this feature at #273?

It seems to me that these overrides should always behave as loose even on strict mocks, to avoid breaking existing behavior (i.e. adding strict mocks to a dictionary would now break :( ).

@kolomanschaft
Copy link
Author

@kzu sounds reasonable. I'll have a look at it tomorrow.

@kzu
Copy link
Contributor

kzu commented Aug 8, 2016

Thanks a lot!

On Mon, Aug 8, 2016 at 8:52 AM Martin Hammerschmied <
notifications@github.com> wrote:

@kzu https://github.com/kzu sounds reasonable. I'll have a look at it
tomorrow.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#250 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAKW67ZycHPkGvtNxkbuwTtEM4UNL1Mrks5qdxhfgaJpZM4Hb4hA
.

/kzu from mobile

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 this pull request may close these issues.

Allow setting up "overrides" for object members when mocking interfaces
3 participants