{"action":"created","comment":{"url":"https://api.github.com/repos/shouldly/shouldly/pulls/comments/58296935","id":58296935,"diff_hunk":"@@ -147,6 +147,24 @@ public static void ShouldNotBeEmpty<T>(this IEnumerable<T> actual, [InstantHandl\n                 throw new ShouldAssertException(new ExpectedShouldlyMessage(actual, customMessage).ToString());\n         }\n \n+        public static T ShouldHaveSingleItem<T>(this IEnumerable<T> actual)\n+        {\n+            return ShouldHaveSingleItem(actual, () => null);\n+        }\n+\n+        public static T ShouldHaveSingleItem<T>(this IEnumerable<T> actual, string customMessage)\n+        {\n+            return ShouldHaveSingleItem(actual, () => customMessage);\n+        }\n+\n+        public static T ShouldHaveSingleItem<T>(this IEnumerable<T> actual, [InstantHandle] Func<string> customMessage)\n+        {\n+            if (actual == null || (actual != null && actual.Count() != 1))","path":"src/Shouldly.Shared/ShouldlyExtensionMethods/ShouldBeEnumerableTestExtensions.cs","position":16,"original_position":16,"commit_id":"5b7f2153e42d87f8de717aba9974b19942e8307e","original_commit_id":"b76ca0b6b873f98a452e076efa2a4437a50ae2a3","user":{"login":"JosephWoodward","id":1237341,"avatar_url":"https://avatars.githubusercontent.com/u/1237341?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephWoodward","html_url":"https://github.com/JosephWoodward","followers_url":"https://api.github.com/users/JosephWoodward/followers","following_url":"https://api.github.com/users/JosephWoodward/following{/other_user}","gists_url":"https://api.github.com/users/JosephWoodward/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephWoodward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephWoodward/subscriptions","organizations_url":"https://api.github.com/users/JosephWoodward/orgs","repos_url":"https://api.github.com/users/JosephWoodward/repos","events_url":"https://api.github.com/users/JosephWoodward/events{/privacy}","received_events_url":"https://api.github.com/users/JosephWoodward/received_events","type":"User","site_admin":false},"body":"Do we need the second null reference check? Wouldn't  `actual == null || actual.Count() != 1` suffice?","created_at":"2016-04-02T17:43:08Z","updated_at":"2016-04-02T17:43:08Z","html_url":"https://github.com/shouldly/shouldly/pull/368#discussion_r58296935","pull_request_url":"https://api.github.com/repos/shouldly/shouldly/pulls/368","_links":{"self":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/comments/58296935"},"html":{"href":"https://github.com/shouldly/shouldly/pull/368#discussion_r58296935"},"pull_request":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/368"}}},"pull_request":{"url":"https://api.github.com/repos/shouldly/shouldly/pulls/368","id":65028427,"html_url":"https://github.com/shouldly/shouldly/pull/368","diff_url":"https://github.com/shouldly/shouldly/pull/368.diff","patch_url":"https://github.com/shouldly/shouldly/pull/368.patch","issue_url":"https://api.github.com/repos/shouldly/shouldly/issues/368","number":368,"state":"open","locked":false,"title":"Added ShouldHaveSingleItem for Enumerables.","user":{"login":"ssiko","id":5487034,"avatar_url":"https://avatars.githubusercontent.com/u/5487034?v=3","gravatar_id":"","url":"https://api.github.com/users/ssiko","html_url":"https://github.com/ssiko","followers_url":"https://api.github.com/users/ssiko/followers","following_url":"https://api.github.com/users/ssiko/following{/other_user}","gists_url":"https://api.github.com/users/ssiko/gists{/gist_id}","starred_url":"https://api.github.com/users/ssiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssiko/subscriptions","organizations_url":"https://api.github.com/users/ssiko/orgs","repos_url":"https://api.github.com/users/ssiko/repos","events_url":"https://api.github.com/users/ssiko/events{/privacy}","received_events_url":"https://api.github.com/users/ssiko/received_events","type":"User","site_admin":false},"body":"Resolve #365 - ShouldHaveSingleItem enhancement, IEnumerable extension method.","created_at":"2016-04-02T05:08:00Z","updated_at":"2016-04-02T17:43:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff488ae033ce2d3056bb4a3459151c46cb12dc51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shouldly/shouldly/pulls/368/commits","review_comments_url":"https://api.github.com/repos/shouldly/shouldly/pulls/368/comments","review_comment_url":"https://api.github.com/repos/shouldly/shouldly/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shouldly/shouldly/issues/368/comments","statuses_url":"https://api.github.com/repos/shouldly/shouldly/statuses/5b7f2153e42d87f8de717aba9974b19942e8307e","head":{"label":"ssiko:ShouldHaveSingleItem","ref":"ShouldHaveSingleItem","sha":"5b7f2153e42d87f8de717aba9974b19942e8307e","user":{"login":"ssiko","id":5487034,"avatar_url":"https://avatars.githubusercontent.com/u/5487034?v=3","gravatar_id":"","url":"https://api.github.com/users/ssiko","html_url":"https://github.com/ssiko","followers_url":"https://api.github.com/users/ssiko/followers","following_url":"https://api.github.com/users/ssiko/following{/other_user}","gists_url":"https://api.github.com/users/ssiko/gists{/gist_id}","starred_url":"https://api.github.com/users/ssiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssiko/subscriptions","organizations_url":"https://api.github.com/users/ssiko/orgs","repos_url":"https://api.github.com/users/ssiko/repos","events_url":"https://api.github.com/users/ssiko/events{/privacy}","received_events_url":"https://api.github.com/users/ssiko/received_events","type":"User","site_admin":false},"repo":{"id":55242292,"name":"shouldly","full_name":"ssiko/shouldly","owner":{"login":"ssiko","id":5487034,"avatar_url":"https://avatars.githubusercontent.com/u/5487034?v=3","gravatar_id":"","url":"https://api.github.com/users/ssiko","html_url":"https://github.com/ssiko","followers_url":"https://api.github.com/users/ssiko/followers","following_url":"https://api.github.com/users/ssiko/following{/other_user}","gists_url":"https://api.github.com/users/ssiko/gists{/gist_id}","starred_url":"https://api.github.com/users/ssiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssiko/subscriptions","organizations_url":"https://api.github.com/users/ssiko/orgs","repos_url":"https://api.github.com/users/ssiko/repos","events_url":"https://api.github.com/users/ssiko/events{/privacy}","received_events_url":"https://api.github.com/users/ssiko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssiko/shouldly","description":"Should testing for .net - the way Asserting *Should* be!","fork":true,"url":"https://api.github.com/repos/ssiko/shouldly","forks_url":"https://api.github.com/repos/ssiko/shouldly/forks","keys_url":"https://api.github.com/repos/ssiko/shouldly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssiko/shouldly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssiko/shouldly/teams","hooks_url":"https://api.github.com/repos/ssiko/shouldly/hooks","issue_events_url":"https://api.github.com/repos/ssiko/shouldly/issues/events{/number}","events_url":"https://api.github.com/repos/ssiko/shouldly/events","assignees_url":"https://api.github.com/repos/ssiko/shouldly/assignees{/user}","branches_url":"https://api.github.com/repos/ssiko/shouldly/branches{/branch}","tags_url":"https://api.github.com/repos/ssiko/shouldly/tags","blobs_url":"https://api.github.com/repos/ssiko/shouldly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssiko/shouldly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssiko/shouldly/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssiko/shouldly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssiko/shouldly/statuses/{sha}","languages_url":"https://api.github.com/repos/ssiko/shouldly/languages","stargazers_url":"https://api.github.com/repos/ssiko/shouldly/stargazers","contributors_url":"https://api.github.com/repos/ssiko/shouldly/contributors","subscribers_url":"https://api.github.com/repos/ssiko/shouldly/subscribers","subscription_url":"https://api.github.com/repos/ssiko/shouldly/subscription","commits_url":"https://api.github.com/repos/ssiko/shouldly/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssiko/shouldly/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssiko/shouldly/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssiko/shouldly/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssiko/shouldly/contents/{+path}","compare_url":"https://api.github.com/repos/ssiko/shouldly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssiko/shouldly/merges","archive_url":"https://api.github.com/repos/ssiko/shouldly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssiko/shouldly/downloads","issues_url":"https://api.github.com/repos/ssiko/shouldly/issues{/number}","pulls_url":"https://api.github.com/repos/ssiko/shouldly/pulls{/number}","milestones_url":"https://api.github.com/repos/ssiko/shouldly/milestones{/number}","notifications_url":"https://api.github.com/repos/ssiko/shouldly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssiko/shouldly/labels{/name}","releases_url":"https://api.github.com/repos/ssiko/shouldly/releases{/id}","deployments_url":"https://api.github.com/repos/ssiko/shouldly/deployments","created_at":"2016-04-01T15:28:20Z","updated_at":"2016-04-01T15:28:22Z","pushed_at":"2016-04-02T05:37:22Z","git_url":"git://github.com/ssiko/shouldly.git","ssh_url":"git@github.com:ssiko/shouldly.git","clone_url":"https://github.com/ssiko/shouldly.git","svn_url":"https://github.com/ssiko/shouldly","homepage":"http://shouldly.readthedocs.org/en/latest","size":22170,"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":"shouldly:master","ref":"master","sha":"029d702a2c3771e51921e2cd64879b05f80bb80b","user":{"login":"shouldly","id":373135,"avatar_url":"https://avatars.githubusercontent.com/u/373135?v=3","gravatar_id":"","url":"https://api.github.com/users/shouldly","html_url":"https://github.com/shouldly","followers_url":"https://api.github.com/users/shouldly/followers","following_url":"https://api.github.com/users/shouldly/following{/other_user}","gists_url":"https://api.github.com/users/shouldly/gists{/gist_id}","starred_url":"https://api.github.com/users/shouldly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shouldly/subscriptions","organizations_url":"https://api.github.com/users/shouldly/orgs","repos_url":"https://api.github.com/users/shouldly/repos","events_url":"https://api.github.com/users/shouldly/events{/privacy}","received_events_url":"https://api.github.com/users/shouldly/received_events","type":"Organization","site_admin":false},"repo":{"id":856112,"name":"shouldly","full_name":"shouldly/shouldly","owner":{"login":"shouldly","id":373135,"avatar_url":"https://avatars.githubusercontent.com/u/373135?v=3","gravatar_id":"","url":"https://api.github.com/users/shouldly","html_url":"https://github.com/shouldly","followers_url":"https://api.github.com/users/shouldly/followers","following_url":"https://api.github.com/users/shouldly/following{/other_user}","gists_url":"https://api.github.com/users/shouldly/gists{/gist_id}","starred_url":"https://api.github.com/users/shouldly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shouldly/subscriptions","organizations_url":"https://api.github.com/users/shouldly/orgs","repos_url":"https://api.github.com/users/shouldly/repos","events_url":"https://api.github.com/users/shouldly/events{/privacy}","received_events_url":"https://api.github.com/users/shouldly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shouldly/shouldly","description":"Should testing for .net - the way Asserting *Should* be!","fork":false,"url":"https://api.github.com/repos/shouldly/shouldly","forks_url":"https://api.github.com/repos/shouldly/shouldly/forks","keys_url":"https://api.github.com/repos/shouldly/shouldly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shouldly/shouldly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shouldly/shouldly/teams","hooks_url":"https://api.github.com/repos/shouldly/shouldly/hooks","issue_events_url":"https://api.github.com/repos/shouldly/shouldly/issues/events{/number}","events_url":"https://api.github.com/repos/shouldly/shouldly/events","assignees_url":"https://api.github.com/repos/shouldly/shouldly/assignees{/user}","branches_url":"https://api.github.com/repos/shouldly/shouldly/branches{/branch}","tags_url":"https://api.github.com/repos/shouldly/shouldly/tags","blobs_url":"https://api.github.com/repos/shouldly/shouldly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shouldly/shouldly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shouldly/shouldly/git/refs{/sha}","trees_url":"https://api.github.com/repos/shouldly/shouldly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shouldly/shouldly/statuses/{sha}","languages_url":"https://api.github.com/repos/shouldly/shouldly/languages","stargazers_url":"https://api.github.com/repos/shouldly/shouldly/stargazers","contributors_url":"https://api.github.com/repos/shouldly/shouldly/contributors","subscribers_url":"https://api.github.com/repos/shouldly/shouldly/subscribers","subscription_url":"https://api.github.com/repos/shouldly/shouldly/subscription","commits_url":"https://api.github.com/repos/shouldly/shouldly/commits{/sha}","git_commits_url":"https://api.github.com/repos/shouldly/shouldly/git/commits{/sha}","comments_url":"https://api.github.com/repos/shouldly/shouldly/comments{/number}","issue_comment_url":"https://api.github.com/repos/shouldly/shouldly/issues/comments{/number}","contents_url":"https://api.github.com/repos/shouldly/shouldly/contents/{+path}","compare_url":"https://api.github.com/repos/shouldly/shouldly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shouldly/shouldly/merges","archive_url":"https://api.github.com/repos/shouldly/shouldly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shouldly/shouldly/downloads","issues_url":"https://api.github.com/repos/shouldly/shouldly/issues{/number}","pulls_url":"https://api.github.com/repos/shouldly/shouldly/pulls{/number}","milestones_url":"https://api.github.com/repos/shouldly/shouldly/milestones{/number}","notifications_url":"https://api.github.com/repos/shouldly/shouldly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shouldly/shouldly/labels{/name}","releases_url":"https://api.github.com/repos/shouldly/shouldly/releases{/id}","deployments_url":"https://api.github.com/repos/shouldly/shouldly/deployments","created_at":"2010-08-23T07:50:00Z","updated_at":"2016-03-22T18:37:00Z","pushed_at":"2016-04-02T05:37:22Z","git_url":"git://github.com/shouldly/shouldly.git","ssh_url":"git@github.com:shouldly/shouldly.git","clone_url":"https://github.com/shouldly/shouldly.git","svn_url":"https://github.com/shouldly/shouldly","homepage":"http://shouldly.readthedocs.org/en/latest","size":51777,"stargazers_count":369,"watchers_count":369,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":119,"mirror_url":null,"open_issues_count":24,"forks":119,"open_issues":24,"watchers":369,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/368"},"html":{"href":"https://github.com/shouldly/shouldly/pull/368"},"issue":{"href":"https://api.github.com/repos/shouldly/shouldly/issues/368"},"comments":{"href":"https://api.github.com/repos/shouldly/shouldly/issues/368/comments"},"review_comments":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/368/comments"},"review_comment":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shouldly/shouldly/pulls/368/commits"},"statuses":{"href":"https://api.github.com/repos/shouldly/shouldly/statuses/5b7f2153e42d87f8de717aba9974b19942e8307e"}}}}