{"action":"created","issue":{"url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/632","labels_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/632/labels{/name}","comments_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/632/comments","events_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/632/events","html_url":"https://github.com/umbraco/Umbraco-CMS/pull/632","id":56490114,"number":632,"title":"Issue U4-5853 - Allows for unit test-able UmbracoHelper and Controllers","user":{"login":"Shazwazza","id":1742685,"avatar_url":"https://avatars.githubusercontent.com/u/1742685?v=3","gravatar_id":"","url":"https://api.github.com/users/Shazwazza","html_url":"https://github.com/Shazwazza","followers_url":"https://api.github.com/users/Shazwazza/followers","following_url":"https://api.github.com/users/Shazwazza/following{/other_user}","gists_url":"https://api.github.com/users/Shazwazza/gists{/gist_id}","starred_url":"https://api.github.com/users/Shazwazza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shazwazza/subscriptions","organizations_url":"https://api.github.com/users/Shazwazza/orgs","repos_url":"https://api.github.com/users/Shazwazza/repos","events_url":"https://api.github.com/users/Shazwazza/events{/privacy}","received_events_url":"https://api.github.com/users/Shazwazza/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-04T07:25:55Z","updated_at":"2015-02-18T16:15:27Z","closed_at":"2015-02-18T16:15:27Z","pull_request":{"url":"https://api.github.com/repos/umbraco/Umbraco-CMS/pulls/632","html_url":"https://github.com/umbraco/Umbraco-CMS/pull/632","diff_url":"https://github.com/umbraco/Umbraco-CMS/pull/632.diff","patch_url":"https://github.com/umbraco/Umbraco-CMS/pull/632.patch"},"body":"This PR does quite a few things to try to decouple a lot of classes and make things more unit testable. Until we have the 'new cache' ready we can't publicize a few things that would make this process even easier, but until then this should still make things like testing Controllers possible and even relatively easy.\r\n\r\nThis splits the UmbracoHelper into it's constituent parts: \r\n\r\n* ITagQuery (new)\r\n* ITypedPublishedContentQuery (new)\r\n* IDynamicPublishedContentQuery (new)\r\n* IUmbracoComponentRenderer (new)\r\n* MembershipHelper\r\n* UrlProvider\r\n* IDataTypeService\r\n* ICultureDictionary\r\n\r\nThis also makes non-interface objects like MembershipHelper and WebSecurity to be mock-able by having virtual methods (where it makes sense) and to allow specifying correct ctor dependencies which can be mocked.\r\n\r\nI've updated the unit tests: MockTests and SurfaceControllerTests to show how to mock the main contexts and also that you can unit test a controller using public APIs.\r\n\r\nAs noted above, there are some things that will not be testable just yet which are on the UmbracoContext until the 'new cache' is ready."},"comment":{"url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/comments/74892534","html_url":"https://github.com/umbraco/Umbraco-CMS/pull/632#issuecomment-74892534","issue_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/632","id":74892534,"user":{"login":"Shazwazza","id":1742685,"avatar_url":"https://avatars.githubusercontent.com/u/1742685?v=3","gravatar_id":"","url":"https://api.github.com/users/Shazwazza","html_url":"https://github.com/Shazwazza","followers_url":"https://api.github.com/users/Shazwazza/followers","following_url":"https://api.github.com/users/Shazwazza/following{/other_user}","gists_url":"https://api.github.com/users/Shazwazza/gists{/gist_id}","starred_url":"https://api.github.com/users/Shazwazza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shazwazza/subscriptions","organizations_url":"https://api.github.com/users/Shazwazza/orgs","repos_url":"https://api.github.com/users/Shazwazza/repos","events_url":"https://api.github.com/users/Shazwazza/events{/privacy}","received_events_url":"https://api.github.com/users/Shazwazza/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T16:15:27Z","updated_at":"2015-02-18T16:15:27Z","body":"manually merged"}}