Created
March 10, 2011 13:22
-
-
Save hurricanepkt/864081 to your computer and use it in GitHub Desktop.
This file contains 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
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