Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit test to verify that a repository loads an entity from the database correctly
- public class SomeCompositionRootEntityRepository :
- IRepository<SomeCompositionRoot>
- {
- public RecipeRepository(IDbConnection connection) { ... }
- public void Add(SomeCompositionRootEntity item) { ... }
- public bool Remove(SomeCompositionRootEntity item) { ... }
- public void Update(SomeCompositionRootEntity item) { ... }
- public SomeCompositionRootEntity GetById(object id) { ... }
- public bool Contains(object id) { ... }
- }
- [TestMethod]
- public void ShouldMapBlahBlahCorrectly()
- {
- CheckBasicMapping<BlahBlah>();
- }
- private T CheckBasicMapping<T>() where T : class
- {
- var target = _testContext.GetTable<T>().FirstOrDefault();
- target.ShouldNotBeNull();
- return target;
- }
Add Comment
Please, Sign In to add comment