{"action":"created","comment":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/comments/200302669","pull_request_review_id":134578391,"id":200302669,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDMwMjY2OQ==","diff_hunk":"@@ -0,0 +1,54 @@\n+﻿using System;\r\n+using System.Collections.Generic;\r\n+using System.Linq;\r\n+using System.Text;\r\n+using System.Threading.Tasks;\r\n+\r\n+namespace FluentValidation.Tests\r\n+{\r\n+\tusing System.Diagnostics;\r\n+\tusing Xunit;\r\n+\r\n+\r\n+\tpublic class OnFailureTests\r\n+\t{\r\n+\t\tprivate TestValidator _validator;\r\n+\t\tpublic OnFailureTests()\r\n+\t\t{\r\n+\t\t\t_validator = new TestValidator();\r\n+\t\t}\r\n+\r\n+\t\t[Fact]\r\n+\t\tpublic void Invokes_twice_for_two_rules_on_failure()\r\n+\t\t{\r\n+\t\t\t_validator.CascadeMode = CascadeMode.Continue;\r\n+\r\n+\t\t\tint invoked = 0;\r\n+\t\t\t_validator.RuleFor(person => person.Surname).NotNull().NotEmpty().OnFailure( person => {\r\n+\t\t\t\tinvoked += 1;\r\n+\t\t\t});\r\n+\r\n+\t\t\t_validator.RuleFor(person => person.Surname).NotEmpty().OnFailure((person,ctx) => {\r\n+\t\t\t\tDebug.WriteLine(ctx.PropertyName);\r\n+\t\t\t\tinvoked += 1;\r\n+\t\t\t});\r\n+\r\n+\t\t\t_validator.RuleFor(person => person.Forename).NotEqual(\"John\").OnFailure((person, ctx, message) =>\r\n+\t\t\t{\r\n+\t\t\t\tDebug.WriteLine(message);\r\n+\t\t\t\tinvoked += 1;\r\n+\t\t\t}, \"Can't be John\");\r\n+\r\n+\t\t\t_validator.RuleFor(person => person.Age).GreaterThanOrEqualTo(18).OnFailure((person, ctx, message) =>\r\n+\t\t\t{\r\n+\t\t\t\tDebug.WriteLine(message);\r\n+\t\t\t\tinvoked += 1;\r\n+\t\t\t}, \"You must be at least 18 years old. You entered: {0}\", person=>person.Age);\r\n+\r\n+\t\t\t_validator.Validate(new Person { Forename=\"John\", Age = 17 });\r\n+\r\n+\t\t\tinvoked.ShouldEqual(4);\r\n+\t\t}\r","path":"src/FluentValidation.Tests/OnFailureTests.cs","position":51,"original_position":51,"commit_id":"656715c30f1da2120612830c6e48858c86dc958d","original_commit_id":"656715c30f1da2120612830c6e48858c86dc958d","user":{"login":"JeremySkinner","id":90130,"node_id":"MDQ6VXNlcjkwMTMw","avatar_url":"https://avatars3.githubusercontent.com/u/90130?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremySkinner","html_url":"https://github.com/JeremySkinner","followers_url":"https://api.github.com/users/JeremySkinner/followers","following_url":"https://api.github.com/users/JeremySkinner/following{/other_user}","gists_url":"https://api.github.com/users/JeremySkinner/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremySkinner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremySkinner/subscriptions","organizations_url":"https://api.github.com/users/JeremySkinner/orgs","repos_url":"https://api.github.com/users/JeremySkinner/repos","events_url":"https://api.github.com/users/JeremySkinner/events{/privacy}","received_events_url":"https://api.github.com/users/JeremySkinner/received_events","type":"User","site_admin":false},"body":"- [ ] Add tests for async workflow. \r\n- [ ] Add tests that ensure testhelper's `ShouldHaveChildValidator` still works","created_at":"2018-07-05T10:18:14Z","updated_at":"2018-07-05T10:21:28Z","html_url":"https://github.com/JeremySkinner/FluentValidation/pull/830#discussion_r200302669","pull_request_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/comments/200302669"},"html":{"href":"https://github.com/JeremySkinner/FluentValidation/pull/830#discussion_r200302669"},"pull_request":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830"}}},"pull_request":{"url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830","id":199407108,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NDA3MTA4","html_url":"https://github.com/JeremySkinner/FluentValidation/pull/830","diff_url":"https://github.com/JeremySkinner/FluentValidation/pull/830.diff","patch_url":"https://github.com/JeremySkinner/FluentValidation/pull/830.patch","issue_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/830","number":830,"state":"open","locked":false,"title":"OnFailure extension method","user":{"login":"Misiu","id":1741838,"node_id":"MDQ6VXNlcjE3NDE4Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1741838?v=4","gravatar_id":"","url":"https://api.github.com/users/Misiu","html_url":"https://github.com/Misiu","followers_url":"https://api.github.com/users/Misiu/followers","following_url":"https://api.github.com/users/Misiu/following{/other_user}","gists_url":"https://api.github.com/users/Misiu/gists{/gist_id}","starred_url":"https://api.github.com/users/Misiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Misiu/subscriptions","organizations_url":"https://api.github.com/users/Misiu/orgs","repos_url":"https://api.github.com/users/Misiu/repos","events_url":"https://api.github.com/users/Misiu/events{/privacy}","received_events_url":"https://api.github.com/users/Misiu/received_events","type":"User","site_admin":false},"body":"This allows specifying action (function) that will be called when a specific rule fails.\r\nIn my case, I'm using it mostly for logging.\r\n\r\nThis PR is an initial version that contains only a single test, if more tests are needed please let me know.\r\nAny improvements on how to simplify `OnFailureValidator` are more than welcome.","created_at":"2018-07-05T09:17:53Z","updated_at":"2018-07-05T10:21:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"273fe8793873453f80a4b8833e0784281ec4fe21","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830/commits","review_comments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830/comments","review_comment_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/830/comments","statuses_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/statuses/656715c30f1da2120612830c6e48858c86dc958d","head":{"label":"Misiu:8.0-preview01","ref":"8.0-preview01","sha":"656715c30f1da2120612830c6e48858c86dc958d","user":{"login":"Misiu","id":1741838,"node_id":"MDQ6VXNlcjE3NDE4Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1741838?v=4","gravatar_id":"","url":"https://api.github.com/users/Misiu","html_url":"https://github.com/Misiu","followers_url":"https://api.github.com/users/Misiu/followers","following_url":"https://api.github.com/users/Misiu/following{/other_user}","gists_url":"https://api.github.com/users/Misiu/gists{/gist_id}","starred_url":"https://api.github.com/users/Misiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Misiu/subscriptions","organizations_url":"https://api.github.com/users/Misiu/orgs","repos_url":"https://api.github.com/users/Misiu/repos","events_url":"https://api.github.com/users/Misiu/events{/privacy}","received_events_url":"https://api.github.com/users/Misiu/received_events","type":"User","site_admin":false},"repo":{"id":139806479,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk4MDY0Nzk=","name":"FluentValidation","full_name":"Misiu/FluentValidation","owner":{"login":"Misiu","id":1741838,"node_id":"MDQ6VXNlcjE3NDE4Mzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1741838?v=4","gravatar_id":"","url":"https://api.github.com/users/Misiu","html_url":"https://github.com/Misiu","followers_url":"https://api.github.com/users/Misiu/followers","following_url":"https://api.github.com/users/Misiu/following{/other_user}","gists_url":"https://api.github.com/users/Misiu/gists{/gist_id}","starred_url":"https://api.github.com/users/Misiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Misiu/subscriptions","organizations_url":"https://api.github.com/users/Misiu/orgs","repos_url":"https://api.github.com/users/Misiu/repos","events_url":"https://api.github.com/users/Misiu/events{/privacy}","received_events_url":"https://api.github.com/users/Misiu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Misiu/FluentValidation","description":"A popular .NET validation for building strongly-typed validation rules.","fork":true,"url":"https://api.github.com/repos/Misiu/FluentValidation","forks_url":"https://api.github.com/repos/Misiu/FluentValidation/forks","keys_url":"https://api.github.com/repos/Misiu/FluentValidation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Misiu/FluentValidation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Misiu/FluentValidation/teams","hooks_url":"https://api.github.com/repos/Misiu/FluentValidation/hooks","issue_events_url":"https://api.github.com/repos/Misiu/FluentValidation/issues/events{/number}","events_url":"https://api.github.com/repos/Misiu/FluentValidation/events","assignees_url":"https://api.github.com/repos/Misiu/FluentValidation/assignees{/user}","branches_url":"https://api.github.com/repos/Misiu/FluentValidation/branches{/branch}","tags_url":"https://api.github.com/repos/Misiu/FluentValidation/tags","blobs_url":"https://api.github.com/repos/Misiu/FluentValidation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Misiu/FluentValidation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Misiu/FluentValidation/git/refs{/sha}","trees_url":"https://api.github.com/repos/Misiu/FluentValidation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Misiu/FluentValidation/statuses/{sha}","languages_url":"https://api.github.com/repos/Misiu/FluentValidation/languages","stargazers_url":"https://api.github.com/repos/Misiu/FluentValidation/stargazers","contributors_url":"https://api.github.com/repos/Misiu/FluentValidation/contributors","subscribers_url":"https://api.github.com/repos/Misiu/FluentValidation/subscribers","subscription_url":"https://api.github.com/repos/Misiu/FluentValidation/subscription","commits_url":"https://api.github.com/repos/Misiu/FluentValidation/commits{/sha}","git_commits_url":"https://api.github.com/repos/Misiu/FluentValidation/git/commits{/sha}","comments_url":"https://api.github.com/repos/Misiu/FluentValidation/comments{/number}","issue_comment_url":"https://api.github.com/repos/Misiu/FluentValidation/issues/comments{/number}","contents_url":"https://api.github.com/repos/Misiu/FluentValidation/contents/{+path}","compare_url":"https://api.github.com/repos/Misiu/FluentValidation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Misiu/FluentValidation/merges","archive_url":"https://api.github.com/repos/Misiu/FluentValidation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Misiu/FluentValidation/downloads","issues_url":"https://api.github.com/repos/Misiu/FluentValidation/issues{/number}","pulls_url":"https://api.github.com/repos/Misiu/FluentValidation/pulls{/number}","milestones_url":"https://api.github.com/repos/Misiu/FluentValidation/milestones{/number}","notifications_url":"https://api.github.com/repos/Misiu/FluentValidation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Misiu/FluentValidation/labels{/name}","releases_url":"https://api.github.com/repos/Misiu/FluentValidation/releases{/id}","deployments_url":"https://api.github.com/repos/Misiu/FluentValidation/deployments","created_at":"2018-07-05T06:45:17Z","updated_at":"2018-07-05T06:45:20Z","pushed_at":"2018-07-05T09:12:41Z","git_url":"git://github.com/Misiu/FluentValidation.git","ssh_url":"git@github.com:Misiu/FluentValidation.git","clone_url":"https://github.com/Misiu/FluentValidation.git","svn_url":"https://github.com/Misiu/FluentValidation","homepage":"https://fluentvalidation.net","size":17440,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JeremySkinner:8.0-preview01","ref":"8.0-preview01","sha":"992f2c90d12be9dbb02789ec6a99e72d6851c11d","user":{"login":"JeremySkinner","id":90130,"node_id":"MDQ6VXNlcjkwMTMw","avatar_url":"https://avatars3.githubusercontent.com/u/90130?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremySkinner","html_url":"https://github.com/JeremySkinner","followers_url":"https://api.github.com/users/JeremySkinner/followers","following_url":"https://api.github.com/users/JeremySkinner/following{/other_user}","gists_url":"https://api.github.com/users/JeremySkinner/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremySkinner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremySkinner/subscriptions","organizations_url":"https://api.github.com/users/JeremySkinner/orgs","repos_url":"https://api.github.com/users/JeremySkinner/repos","events_url":"https://api.github.com/users/JeremySkinner/events{/privacy}","received_events_url":"https://api.github.com/users/JeremySkinner/received_events","type":"User","site_admin":false},"repo":{"id":443962,"node_id":"MDEwOlJlcG9zaXRvcnk0NDM5NjI=","name":"FluentValidation","full_name":"JeremySkinner/FluentValidation","owner":{"login":"JeremySkinner","id":90130,"node_id":"MDQ6VXNlcjkwMTMw","avatar_url":"https://avatars3.githubusercontent.com/u/90130?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremySkinner","html_url":"https://github.com/JeremySkinner","followers_url":"https://api.github.com/users/JeremySkinner/followers","following_url":"https://api.github.com/users/JeremySkinner/following{/other_user}","gists_url":"https://api.github.com/users/JeremySkinner/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremySkinner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremySkinner/subscriptions","organizations_url":"https://api.github.com/users/JeremySkinner/orgs","repos_url":"https://api.github.com/users/JeremySkinner/repos","events_url":"https://api.github.com/users/JeremySkinner/events{/privacy}","received_events_url":"https://api.github.com/users/JeremySkinner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JeremySkinner/FluentValidation","description":"A popular .NET validation for building strongly-typed validation rules.","fork":false,"url":"https://api.github.com/repos/JeremySkinner/FluentValidation","forks_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/forks","keys_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/teams","hooks_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/hooks","issue_events_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/events{/number}","events_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/events","assignees_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/assignees{/user}","branches_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/branches{/branch}","tags_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/tags","blobs_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/git/refs{/sha}","trees_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/statuses/{sha}","languages_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/languages","stargazers_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/stargazers","contributors_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/contributors","subscribers_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/subscribers","subscription_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/subscription","commits_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/commits{/sha}","git_commits_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/git/commits{/sha}","comments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/comments{/number}","issue_comment_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/comments{/number}","contents_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/contents/{+path}","compare_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/merges","archive_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/downloads","issues_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues{/number}","pulls_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls{/number}","milestones_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/milestones{/number}","notifications_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/labels{/name}","releases_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/releases{/id}","deployments_url":"https://api.github.com/repos/JeremySkinner/FluentValidation/deployments","created_at":"2009-12-20T19:17:03Z","updated_at":"2018-07-04T09:34:45Z","pushed_at":"2018-07-05T09:17:54Z","git_url":"git://github.com/JeremySkinner/FluentValidation.git","ssh_url":"git@github.com:JeremySkinner/FluentValidation.git","clone_url":"https://github.com/JeremySkinner/FluentValidation.git","svn_url":"https://github.com/JeremySkinner/FluentValidation","homepage":"https://fluentvalidation.net","size":17428,"stargazers_count":3382,"watchers_count":3382,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":594,"mirror_url":null,"archived":false,"open_issues_count":32,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":594,"open_issues":32,"watchers":3382,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830"},"html":{"href":"https://github.com/JeremySkinner/FluentValidation/pull/830"},"issue":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/830"},"comments":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/issues/830/comments"},"review_comments":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830/comments"},"review_comment":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/pulls/830/commits"},"statuses":{"href":"https://api.github.com/repos/JeremySkinner/FluentValidation/statuses/656715c30f1da2120612830c6e48858c86dc958d"}},"author_association":"NONE"}}
{"actor":{"display_login":"JeremySkinner"}}