Guest User

Untitled

a guest
Aug 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. unit test to verify that a repository loads an entity from the database correctly
  2. public class SomeCompositionRootEntityRepository :
  3. IRepository<SomeCompositionRoot>
  4. {
  5. public RecipeRepository(IDbConnection connection) { ... }
  6. public void Add(SomeCompositionRootEntity item) { ... }
  7. public bool Remove(SomeCompositionRootEntity item) { ... }
  8. public void Update(SomeCompositionRootEntity item) { ... }
  9. public SomeCompositionRootEntity GetById(object id) { ... }
  10. public bool Contains(object id) { ... }
  11. }
  12.  
  13. [TestMethod]
  14. public void ShouldMapBlahBlahCorrectly()
  15. {
  16. CheckBasicMapping<BlahBlah>();
  17. }
  18.  
  19. private T CheckBasicMapping<T>() where T : class
  20. {
  21. var target = _testContext.GetTable<T>().FirstOrDefault();
  22. target.ShouldNotBeNull();
  23. return target;
  24. }
Add Comment
Please, Sign In to add comment