{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/8003","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/8003/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/8003/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/8003/events","html_url":"https://github.com/aspnet/Mvc/issues/8003","id":337686355,"node_id":"MDU6SXNzdWUzMzc2ODYzNTU=","number":8003,"title":"Make ControllerBase.User virtual so it can be mocked ","user":{"login":"SimonCropp","id":122666,"node_id":"MDQ6VXNlcjEyMjY2Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/122666?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonCropp","html_url":"https://github.com/SimonCropp","followers_url":"https://api.github.com/users/SimonCropp/followers","following_url":"https://api.github.com/users/SimonCropp/following{/other_user}","gists_url":"https://api.github.com/users/SimonCropp/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonCropp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonCropp/subscriptions","organizations_url":"https://api.github.com/users/SimonCropp/orgs","repos_url":"https://api.github.com/users/SimonCropp/repos","events_url":"https://api.github.com/users/SimonCropp/events{/privacy}","received_events_url":"https://api.github.com/users/SimonCropp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-02T22:35:40Z","updated_at":"2018-07-02T22:45:21Z","closed_at":"2018-07-02T22:44:08Z","author_association":"NONE","body":" Make `ControllerBase.User` virtual so it can be mocked for testing purposes\r\n\r\nhttps://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs#L195\r\n\r\nSeems most other members are virtual, so it would seem reasonable."},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/401959879","html_url":"https://github.com/aspnet/Mvc/issues/8003#issuecomment-401959879","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/8003","id":401959879,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTk1OTg3OQ==","user":{"login":"SimonCropp","id":122666,"node_id":"MDQ6VXNlcjEyMjY2Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/122666?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonCropp","html_url":"https://github.com/SimonCropp","followers_url":"https://api.github.com/users/SimonCropp/followers","following_url":"https://api.github.com/users/SimonCropp/following{/other_user}","gists_url":"https://api.github.com/users/SimonCropp/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonCropp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonCropp/subscriptions","organizations_url":"https://api.github.com/users/SimonCropp/orgs","repos_url":"https://api.github.com/users/SimonCropp/repos","events_url":"https://api.github.com/users/SimonCropp/events{/privacy}","received_events_url":"https://api.github.com/users/SimonCropp/received_events","type":"User","site_admin":false},"created_at":"2018-07-02T22:45:21Z","updated_at":"2018-07-02T22:45:21Z","author_association":"NONE","body":"workaround for the next person\r\n\r\n```\r\nvar controller = new MyController()\r\n{\r\n    ControllerContext = new ControllerContext\r\n    {\r\n        HttpContext = new DefaultHttpContext\r\n        {\r\n            User = new ClaimsPrincipal()\r\n        }\r\n    }\r\n};\r\n```\r\n\r\nnot that this is not really a viable long term solution, since it requires knowledge of the internal workings of ControllerBase to know it is even possible"}}
{"actor":{"display_login":"SimonCropp"}}