{"action":"created","comment":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/comments/25416164","id":25416164,"diff_hunk":"@@ -0,0 +1,364 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Globalization;\n+using System.Linq;\n+using System.Reflection;\n+using System.Text;\n+using System.Threading;\n+using Ploeh.AutoFixture.Kernel;\n+\n+namespace Ploeh.AutoFixture.Idioms\n+{\n+\t/// <summary>\n+\t/// Represent an assertion which verifies that an equality method returns the correct value.\n+\t/// </summary>\n+\tpublic class EqualityAssertion : IdiomaticAssertion\n+\t{\n+\t\tprivate readonly Func<object, object, bool> comparer;\n+\t\tprivate IFixture fixture;\n+\n+\t\t/// <summary>\n+\t\t/// Creates a new instance of EqualityAssertion which verified the Object.Equals method\n+\t\t/// </summary>\n+\t\t/// <param name=\"fixture\">A composer which can create instances required to implement the idiomatic unit test.</param>\n+\t\tpublic EqualityAssertion(IFixture fixture)\n+\t\t\t: this(fixture, (x, y) => x.Equals(y))\n+\t\t{\n+\t\t}\n+\n+\t\t/// <summary>\n+\t\t/// Creates a new instance of EqualityAssertion which verified the given equality comparer\n+\t\t/// </summary>\n+\t\t/// <param name=\"fixture\">A composer which can create instances required to implement the idiomatic unit test.</param>\n+\t\t/// <param name=\"comparer\">The equality comparer</param>\n+\t\tpublic EqualityAssertion(IFixture fixture, Func<object, object, bool> comparer)\n+\t\t{\n+\t\t\tif (fixture == null) throw new ArgumentNullException(\"fixture\");\n+\t\t\tif (comparer == null) throw new ArgumentNullException(\"comparer\");\n+\t\t\tthis.fixture = fixture;\n+\t\t\tthis.comparer = comparer;\n+\t\t}\n+\n+\t\t/// <summary>\n+\t\t/// Gets the fixture supplied by the constructor\n+\t\t/// </summary>\n+\t\tpublic IFixture Fixture\n+\t\t{\n+\t\t\tget { return this.fixture; }\n+\t\t}\n+\n+\t\t/// <summary>\n+\t\t/// Gets the comparer supplied by the constructor\n+\t\t/// </summary>\n+\t\tpublic Func<object, object, bool> Comparer","path":"Src/Idioms/EqualityAssertion.cs","position":53,"original_position":53,"commit_id":"cddfd6bad10db1e9e641107133aa4b0e3fb3bcc1","original_commit_id":"cddfd6bad10db1e9e641107133aa4b0e3fb3bcc1","user":{"login":"adamchester","id":570470,"avatar_url":"https://avatars.githubusercontent.com/u/570470?v=3","gravatar_id":"","url":"https://api.github.com/users/adamchester","html_url":"https://github.com/adamchester","followers_url":"https://api.github.com/users/adamchester/followers","following_url":"https://api.github.com/users/adamchester/following{/other_user}","gists_url":"https://api.github.com/users/adamchester/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchester/subscriptions","organizations_url":"https://api.github.com/users/adamchester/orgs","repos_url":"https://api.github.com/users/adamchester/repos","events_url":"https://api.github.com/users/adamchester/events{/privacy}","received_events_url":"https://api.github.com/users/adamchester/received_events","type":"User","site_admin":false},"body":"It would be more clear and consistent if you used an `IEqualityComparer` here.","created_at":"2015-02-26T10:10:56Z","updated_at":"2015-02-26T10:10:56Z","html_url":"https://github.com/AutoFixture/AutoFixture/pull/353#discussion_r25416164","pull_request_url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353","_links":{"self":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/comments/25416164"},"html":{"href":"https://github.com/AutoFixture/AutoFixture/pull/353#discussion_r25416164"},"pull_request":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353"}}},"pull_request":{"url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353","id":30057935,"html_url":"https://github.com/AutoFixture/AutoFixture/pull/353","diff_url":"https://github.com/AutoFixture/AutoFixture/pull/353.diff","patch_url":"https://github.com/AutoFixture/AutoFixture/pull/353.patch","issue_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/353","number":353,"state":"open","locked":false,"title":"Adding EqualityAssertion.","user":{"login":"Galad","id":2237019,"avatar_url":"https://avatars.githubusercontent.com/u/2237019?v=3","gravatar_id":"","url":"https://api.github.com/users/Galad","html_url":"https://github.com/Galad","followers_url":"https://api.github.com/users/Galad/followers","following_url":"https://api.github.com/users/Galad/following{/other_user}","gists_url":"https://api.github.com/users/Galad/gists{/gist_id}","starred_url":"https://api.github.com/users/Galad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Galad/subscriptions","organizations_url":"https://api.github.com/users/Galad/orgs","repos_url":"https://api.github.com/users/Galad/repos","events_url":"https://api.github.com/users/Galad/events{/privacy}","received_events_url":"https://api.github.com/users/Galad/received_events","type":"User","site_admin":false},"body":"This PR fixes issue #98 \r\n\r\nIt assert that the given equality comparer behaves correctly.\r\n\r\nThe assertion is performed for each `ConstructorInfo`, `PropertyInfo` and `FieldInfo`.\r\nIt uses the new MatchOnCustomization in order freeze values.\r\n\r\nHere is how to use it : \r\n\r\n    var assertion = new EqualityAssertion(new Fixture());\r\n    assertion.Verify(typeof(MyValueClass));\r\n\r\nBy default it uses Object.Equals, but you can also use a custom comparer :\r\n\r\n    var assertion = new EqualityAssertion(new Fixture(), (x,y) => x == y);\r\n\r\nWhen verifying the `ConstructorInfo` it does the following :\r\nIt creates 2 same instances with the given constructor, by freezing all the `ParameterInfo`, and verifies that the 2 instances are equal.\r\nIt iterates over all the `ParameterInfo` and freeze all except one. Then create 2 instances and verifies that they are not equal.\r\n\r\nWhen verifiying the `PropertyInfo` and `FieldInfo`, it freezes all members of the `ReflectedType` except the given `PropertyInfo` or `FieldInfo`, creates 2 instances and verifies they are not equal.","created_at":"2015-02-26T08:15:55Z","updated_at":"2015-02-26T10:10:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ee1022a82b7dc861a8749fb858dd3a363ec4acb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353/commits","review_comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353/comments","review_comment_url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/353/comments","statuses_url":"https://api.github.com/repos/AutoFixture/AutoFixture/statuses/cddfd6bad10db1e9e641107133aa4b0e3fb3bcc1","head":{"label":"Galad:idioms-equalassertion","ref":"idioms-equalassertion","sha":"cddfd6bad10db1e9e641107133aa4b0e3fb3bcc1","user":{"login":"Galad","id":2237019,"avatar_url":"https://avatars.githubusercontent.com/u/2237019?v=3","gravatar_id":"","url":"https://api.github.com/users/Galad","html_url":"https://github.com/Galad","followers_url":"https://api.github.com/users/Galad/followers","following_url":"https://api.github.com/users/Galad/following{/other_user}","gists_url":"https://api.github.com/users/Galad/gists{/gist_id}","starred_url":"https://api.github.com/users/Galad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Galad/subscriptions","organizations_url":"https://api.github.com/users/Galad/orgs","repos_url":"https://api.github.com/users/Galad/repos","events_url":"https://api.github.com/users/Galad/events{/privacy}","received_events_url":"https://api.github.com/users/Galad/received_events","type":"User","site_admin":false},"repo":{"id":30826095,"name":"AutoFixture","full_name":"Galad/AutoFixture","owner":{"login":"Galad","id":2237019,"avatar_url":"https://avatars.githubusercontent.com/u/2237019?v=3","gravatar_id":"","url":"https://api.github.com/users/Galad","html_url":"https://github.com/Galad","followers_url":"https://api.github.com/users/Galad/followers","following_url":"https://api.github.com/users/Galad/following{/other_user}","gists_url":"https://api.github.com/users/Galad/gists{/gist_id}","starred_url":"https://api.github.com/users/Galad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Galad/subscriptions","organizations_url":"https://api.github.com/users/Galad/orgs","repos_url":"https://api.github.com/users/Galad/repos","events_url":"https://api.github.com/users/Galad/events{/privacy}","received_events_url":"https://api.github.com/users/Galad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Galad/AutoFixture","description":"AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximise maintainability.Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.","fork":true,"url":"https://api.github.com/repos/Galad/AutoFixture","forks_url":"https://api.github.com/repos/Galad/AutoFixture/forks","keys_url":"https://api.github.com/repos/Galad/AutoFixture/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Galad/AutoFixture/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Galad/AutoFixture/teams","hooks_url":"https://api.github.com/repos/Galad/AutoFixture/hooks","issue_events_url":"https://api.github.com/repos/Galad/AutoFixture/issues/events{/number}","events_url":"https://api.github.com/repos/Galad/AutoFixture/events","assignees_url":"https://api.github.com/repos/Galad/AutoFixture/assignees{/user}","branches_url":"https://api.github.com/repos/Galad/AutoFixture/branches{/branch}","tags_url":"https://api.github.com/repos/Galad/AutoFixture/tags","blobs_url":"https://api.github.com/repos/Galad/AutoFixture/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Galad/AutoFixture/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Galad/AutoFixture/git/refs{/sha}","trees_url":"https://api.github.com/repos/Galad/AutoFixture/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Galad/AutoFixture/statuses/{sha}","languages_url":"https://api.github.com/repos/Galad/AutoFixture/languages","stargazers_url":"https://api.github.com/repos/Galad/AutoFixture/stargazers","contributors_url":"https://api.github.com/repos/Galad/AutoFixture/contributors","subscribers_url":"https://api.github.com/repos/Galad/AutoFixture/subscribers","subscription_url":"https://api.github.com/repos/Galad/AutoFixture/subscription","commits_url":"https://api.github.com/repos/Galad/AutoFixture/commits{/sha}","git_commits_url":"https://api.github.com/repos/Galad/AutoFixture/git/commits{/sha}","comments_url":"https://api.github.com/repos/Galad/AutoFixture/comments{/number}","issue_comment_url":"https://api.github.com/repos/Galad/AutoFixture/issues/comments{/number}","contents_url":"https://api.github.com/repos/Galad/AutoFixture/contents/{+path}","compare_url":"https://api.github.com/repos/Galad/AutoFixture/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Galad/AutoFixture/merges","archive_url":"https://api.github.com/repos/Galad/AutoFixture/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Galad/AutoFixture/downloads","issues_url":"https://api.github.com/repos/Galad/AutoFixture/issues{/number}","pulls_url":"https://api.github.com/repos/Galad/AutoFixture/pulls{/number}","milestones_url":"https://api.github.com/repos/Galad/AutoFixture/milestones{/number}","notifications_url":"https://api.github.com/repos/Galad/AutoFixture/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Galad/AutoFixture/labels{/name}","releases_url":"https://api.github.com/repos/Galad/AutoFixture/releases{/id}","created_at":"2015-02-15T11:54:04Z","updated_at":"2015-02-15T11:54:07Z","pushed_at":"2015-02-26T08:09:17Z","git_url":"git://github.com/Galad/AutoFixture.git","ssh_url":"git@github.com:Galad/AutoFixture.git","clone_url":"https://github.com/Galad/AutoFixture.git","svn_url":"https://github.com/Galad/AutoFixture","homepage":"","size":32408,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AutoFixture:master","ref":"master","sha":"d02f102301af95908e31dcb0e5c628abe48cbb8b","user":{"login":"AutoFixture","id":1786815,"avatar_url":"https://avatars.githubusercontent.com/u/1786815?v=3","gravatar_id":"","url":"https://api.github.com/users/AutoFixture","html_url":"https://github.com/AutoFixture","followers_url":"https://api.github.com/users/AutoFixture/followers","following_url":"https://api.github.com/users/AutoFixture/following{/other_user}","gists_url":"https://api.github.com/users/AutoFixture/gists{/gist_id}","starred_url":"https://api.github.com/users/AutoFixture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutoFixture/subscriptions","organizations_url":"https://api.github.com/users/AutoFixture/orgs","repos_url":"https://api.github.com/users/AutoFixture/repos","events_url":"https://api.github.com/users/AutoFixture/events{/privacy}","received_events_url":"https://api.github.com/users/AutoFixture/received_events","type":"Organization","site_admin":false},"repo":{"id":4475900,"name":"AutoFixture","full_name":"AutoFixture/AutoFixture","owner":{"login":"AutoFixture","id":1786815,"avatar_url":"https://avatars.githubusercontent.com/u/1786815?v=3","gravatar_id":"","url":"https://api.github.com/users/AutoFixture","html_url":"https://github.com/AutoFixture","followers_url":"https://api.github.com/users/AutoFixture/followers","following_url":"https://api.github.com/users/AutoFixture/following{/other_user}","gists_url":"https://api.github.com/users/AutoFixture/gists{/gist_id}","starred_url":"https://api.github.com/users/AutoFixture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutoFixture/subscriptions","organizations_url":"https://api.github.com/users/AutoFixture/orgs","repos_url":"https://api.github.com/users/AutoFixture/repos","events_url":"https://api.github.com/users/AutoFixture/events{/privacy}","received_events_url":"https://api.github.com/users/AutoFixture/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AutoFixture/AutoFixture","description":"AutoFixture is an open source library for .NET designed to minimize the 'Arrange' phase of your unit tests in order to maximise maintainability.Its primary goal is to allow developers to focus on what is being tested rather than how to setup the test scenario, by making it easier to create object graphs containing test data.","fork":false,"url":"https://api.github.com/repos/AutoFixture/AutoFixture","forks_url":"https://api.github.com/repos/AutoFixture/AutoFixture/forks","keys_url":"https://api.github.com/repos/AutoFixture/AutoFixture/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AutoFixture/AutoFixture/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AutoFixture/AutoFixture/teams","hooks_url":"https://api.github.com/repos/AutoFixture/AutoFixture/hooks","issue_events_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/events{/number}","events_url":"https://api.github.com/repos/AutoFixture/AutoFixture/events","assignees_url":"https://api.github.com/repos/AutoFixture/AutoFixture/assignees{/user}","branches_url":"https://api.github.com/repos/AutoFixture/AutoFixture/branches{/branch}","tags_url":"https://api.github.com/repos/AutoFixture/AutoFixture/tags","blobs_url":"https://api.github.com/repos/AutoFixture/AutoFixture/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AutoFixture/AutoFixture/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AutoFixture/AutoFixture/git/refs{/sha}","trees_url":"https://api.github.com/repos/AutoFixture/AutoFixture/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AutoFixture/AutoFixture/statuses/{sha}","languages_url":"https://api.github.com/repos/AutoFixture/AutoFixture/languages","stargazers_url":"https://api.github.com/repos/AutoFixture/AutoFixture/stargazers","contributors_url":"https://api.github.com/repos/AutoFixture/AutoFixture/contributors","subscribers_url":"https://api.github.com/repos/AutoFixture/AutoFixture/subscribers","subscription_url":"https://api.github.com/repos/AutoFixture/AutoFixture/subscription","commits_url":"https://api.github.com/repos/AutoFixture/AutoFixture/commits{/sha}","git_commits_url":"https://api.github.com/repos/AutoFixture/AutoFixture/git/commits{/sha}","comments_url":"https://api.github.com/repos/AutoFixture/AutoFixture/comments{/number}","issue_comment_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/comments{/number}","contents_url":"https://api.github.com/repos/AutoFixture/AutoFixture/contents/{+path}","compare_url":"https://api.github.com/repos/AutoFixture/AutoFixture/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AutoFixture/AutoFixture/merges","archive_url":"https://api.github.com/repos/AutoFixture/AutoFixture/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AutoFixture/AutoFixture/downloads","issues_url":"https://api.github.com/repos/AutoFixture/AutoFixture/issues{/number}","pulls_url":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls{/number}","milestones_url":"https://api.github.com/repos/AutoFixture/AutoFixture/milestones{/number}","notifications_url":"https://api.github.com/repos/AutoFixture/AutoFixture/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AutoFixture/AutoFixture/labels{/name}","releases_url":"https://api.github.com/repos/AutoFixture/AutoFixture/releases{/id}","created_at":"2012-05-29T00:00:02Z","updated_at":"2015-02-25T19:43:57Z","pushed_at":"2015-02-21T11:30:57Z","git_url":"git://github.com/AutoFixture/AutoFixture.git","ssh_url":"git@github.com:AutoFixture/AutoFixture.git","clone_url":"https://github.com/AutoFixture/AutoFixture.git","svn_url":"https://github.com/AutoFixture/AutoFixture","homepage":"","size":32412,"stargazers_count":482,"watchers_count":482,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":36,"forks":95,"open_issues":36,"watchers":482,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353"},"html":{"href":"https://github.com/AutoFixture/AutoFixture/pull/353"},"issue":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/353"},"comments":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/issues/353/comments"},"review_comments":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353/comments"},"review_comment":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/pulls/353/commits"},"statuses":{"href":"https://api.github.com/repos/AutoFixture/AutoFixture/statuses/cddfd6bad10db1e9e641107133aa4b0e3fb3bcc1"}}}}