Last active
December 14, 2015 14:29
-
-
Save alanstevens/5100550 to your computer and use it in GitHub Desktop.
ASP.NET MVC IDependencyResolver stub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Web.Mvc; | |
using default_auth_review.Controllers; | |
namespace default_auth_review.Lib | |
{ | |
public class StubDependencyResolver : IDependencyResolver | |
{ | |
public object GetService(Type serviceType) | |
{ | |
if (serviceType == typeof (AccountController)) | |
return new AccountController(new UserServiceStub(), new AuthenticationServiceStub()); | |
return null; | |
} | |
public IEnumerable<object> GetServices(Type serviceType) | |
{ | |
yield break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment