public UnitOfWork(IBookstoreContext bookstoreContext) { if (bookstoreContext == null) { throw new ArgumentNullException("Context should not be null"); } this.bookstoreContext = bookstoreContext; }
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>(); }
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; }
public void ThrowNullException_When_RepositoryInvokedWithNullContext() { IBookstoreContext mockBookstoreContext = null; Assert.ThrowsException <ArgumentNullException>((() => new GenericRepository <Book>(mockBookstoreContext))); }
public BookRepository(IBookstoreContext context) : base(context) { }
public void ThrowArgumentNullException_WhenInvokedWithNullContext() { IBookstoreContext mockBookstoreContext = null; Assert.ThrowsException <ArgumentNullException>((() => new Data.UnitOfWork(mockBookstoreContext))); }
public BookstoreUserStore(IBookstoreContext context) : base((BookstoreContext)context) { }