Skip to content

Instantly share code, notes, and snippets.

@hurricanepkt
Created March 10, 2011 13:22
Show Gist options
  • Save hurricanepkt/864081 to your computer and use it in GitHub Desktop.
Save hurricanepkt/864081 to your computer and use it in GitHub Desktop.
namespace MvcApplication1
{
class TestModule : NinjectModule
{
public override void Load()
{
Bind<IPersonRepository>().To<FakePersonRepository>();
}
}
[TestFixture]
public class RepositoryTests
{
private readonly StandardKernel _kernel = new StandardKernel();
private readonly IPersonRepository personRepository;
[Inject]
public RepositoryTests()
{
IKernel kernel = new StandardKernel(new TestModule());
personRepository = kernel.Get<IPersonRepository>();
}
[SetUp]
public void Start()
{
}
[Test]
public void CheckRepositoryIsEmptyOnStart()
{
if (personRepository == null)
{
throw new NullReferenceException("Person Repoistory never Injected : is Null");
}
var records = personRepository.GetAllPeople();
Assert.AreEqual(0, records.Count());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment