Skip to content

Instantly share code, notes, and snippets.

@alanstevens
Last active December 14, 2015 14:29
Show Gist options
  • Save alanstevens/5100550 to your computer and use it in GitHub Desktop.
Save alanstevens/5100550 to your computer and use it in GitHub Desktop.
ASP.NET MVC IDependencyResolver stub
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