{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197","labels_url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197/comments","events_url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197/events","html_url":"https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197","id":124983648,"number":197,"title":"Making ASOS More Unit Test Friendly","user":{"login":"emilyclairelewis42","id":8770959,"avatar_url":"https://avatars.githubusercontent.com/u/8770959?v=3","gravatar_id":"","url":"https://api.github.com/users/emilyclairelewis42","html_url":"https://github.com/emilyclairelewis42","followers_url":"https://api.github.com/users/emilyclairelewis42/followers","following_url":"https://api.github.com/users/emilyclairelewis42/following{/other_user}","gists_url":"https://api.github.com/users/emilyclairelewis42/gists{/gist_id}","starred_url":"https://api.github.com/users/emilyclairelewis42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilyclairelewis42/subscriptions","organizations_url":"https://api.github.com/users/emilyclairelewis42/orgs","repos_url":"https://api.github.com/users/emilyclairelewis42/repos","events_url":"https://api.github.com/users/emilyclairelewis42/events{/privacy}","received_events_url":"https://api.github.com/users/emilyclairelewis42/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/labels/discussion%20pending","name":"discussion pending","color":"d4c5f9"},{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/milestones/4","html_url":"https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/milestones/1.0.0-beta5","labels_url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/milestones/4/labels","id":1387359,"number":4,"title":"1.0.0-beta5","description":null,"creator":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":9,"state":"open","created_at":"2015-11-01T15:29:24Z","updated_at":"2016-01-26T02:24:58Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-01-05T15:01:24Z","updated_at":"2016-02-02T02:40:53Z","closed_at":null,"body":"I thoroughly appreciate your efforts with ASOS and we're having very good luck with this software in our API environment, so nice work! \r\n\r\nNow we're at the point in our own ASOS usage we are finding some friction points in unit testing our code because certain ASOS types are not easily mocked. \r\n\r\nFor example - all the OpenIdConnectServerProvider events pass ASOS types like LogoutEndpointContext and ValidateClientAuthenticationContext as parameters to event handlers. This means my unit tests for my OpenIdConnectServerProvider event handlers need to pass instances of those primitives (e.g. LogoutEndpointContext) to the code under test. The problem is all these primitives are sealed and have internal constructors. Normally I would use fakes to mock out these types but fakes doesn't appear to be available for DNX, at least not yet. I can't use MOQ because the ASOS types (e.g. LogoutEndpointContext) aren't abstract and they aren't interfaces either. \r\n\r\nThis has forced me to use reflection to construct these types manually which of course is brittle and clearly working around your design objectives.\r\n\r\nThough I know you might suggest we do more integration style testing a simple change in the ASOS code base would accommodate unit testing. One approach would be that you simply make your public types such as LogoutEndpointContext and ValidateClientAuthenticationContext abstract, taking a page from basic types in the Microsoft.AspNet.* namespace such as HttpRequest and HttpContext, which are all abstract and therefore mockable.\r\n\r\nAnother approach would be to slap an interface in front of all your concretes, like ILogoutEndpointContext and IValidateClientAuthenticationContext, and change the OpenIdConnectServerProvider event signatures to match.\r\n\r\nThanks again for your hard work, and I hope this suggestion makes it into your main line soon!"},"comment":{"url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/comments/178323766","html_url":"https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197#issuecomment-178323766","issue_url":"https://api.github.com/repos/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/issues/197","id":178323766,"user":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T02:40:53Z","updated_at":"2016-02-02T02:40:53Z","body":":watch: "}}