Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Issue U4-5853 - Allows for unit test-able UmbracoHelper and Controllers #632
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.
This splits the UmbracoHelper into it's constituent parts:
This 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.
I'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.
As noted above, there are some things that will not be testable just yet which are on the UmbracoContext until the 'new cache' is ready.