daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Aug 21st, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top