예제 #1
0
 public UnitOfWork(IBookstoreContext bookstoreContext)
 {
     if (bookstoreContext == null)
     {
         throw new ArgumentNullException("Context should not be null");
     }
     this.bookstoreContext = bookstoreContext;
 }
예제 #2
0
        public GenericRepository(IBookstoreContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("An instance of BookstoreContext is required to use this repository.", "context");
            }

            this.context = context;
            this.dbSet   = context.Set <T>();
        }
예제 #3
0
 public UnitOfWork(
     IBookstoreContext bookstoreContext,
     IRepository <BookstoreUser> users,
     IRepository <Book> books,
     IRepository <Author> authors,
     IRepository <Category> categories,
     IRepository <Order> orders,
     IReadOnlyRepository <OrderStatus> orderStatuses,
     IRepository <Wishlist> wishlists,
     IRepository <ShoppingCart> shoppingCarts,
     IReadOnlyRepository <ShoppingCartStatus> shoppingCartStatuses)
 {
     this.bookstoreContext     = bookstoreContext;
     this.users                = users;
     this.books                = books;
     this.authors              = authors;
     this.categories           = categories;
     this.orders               = orders;
     this.orderStatuses        = orderStatuses;
     this.wishlists            = wishlists;
     this.shoppingCarts        = shoppingCarts;
     this.shoppingCartStatuses = shoppingCartStatuses;
 }
예제 #4
0
        public void ThrowNullException_When_RepositoryInvokedWithNullContext()
        {
            IBookstoreContext mockBookstoreContext = null;

            Assert.ThrowsException <ArgumentNullException>((() => new GenericRepository <Book>(mockBookstoreContext)));
        }
 public BookRepository(IBookstoreContext context)
     : base(context)
 {
 }
예제 #6
0
        public void ThrowArgumentNullException_WhenInvokedWithNullContext()
        {
            IBookstoreContext mockBookstoreContext = null;

            Assert.ThrowsException <ArgumentNullException>((() => new Data.UnitOfWork(mockBookstoreContext)));
        }
예제 #7
0
 public BookstoreUserStore(IBookstoreContext context)
     : base((BookstoreContext)context)
 {
 }