protected BaseBookRepository(IBookUnitOfWork unitOfWork) { //For Actual // BookDbContext = unitOfWork.Context as BookDbContext; //For Test BookDbContext = unitOfWork.Context; if (BookDbContext == null) { throw new NullReferenceException("Book DbContext is null"); } _dbSet = BookDbContext.DbSet <T, TId>(); }
private void Setup() { _context = new FakeBookContext(); _context.Books.Add(new Book { Id = 1, TitleB = "Bengali Book1", TitleE = "Englishi Book1", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _context.Books.Add(new Book { Id = 2, TitleB = "Bengali Book2", TitleE = "Englishi Book2", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _context.Books.Add(new Book { Id = 3, TitleB = "Bengali Book3", TitleE = "Englishi Book3", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _bookUnitOfWork = new BookUnitOfWork(_context); _bookRepository = new BookRepository(_bookUnitOfWork); }
private void Setup() { _context = new FakeBookContext(); _context.Books.Add(new Book { Id = 1, TitleB = "Bengali Book1", TitleE = "Englishi Book1", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _context.Books.Add(new Book { Id = 2, TitleB = "Bengali Book2", TitleE = "Englishi Book2", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _context.Books.Add(new Book { Id = 3, TitleB = "Bengali Book3", TitleE = "Englishi Book3", IsActive = 1, Price = 1, CreationDate = DateTime.Today, PublishedDate = DateTime.Today, }); _bookUnitOfWork = new BookUnitOfWork(_context); _bookRepository = new BookRepository(_bookUnitOfWork); }
public GetAuthorByIdHandler(IBookDbContext context) { _context = context; }
public GetAllAuthorsHandler(IBookDbContext context) { _context = context; }
public AddAuthorCommandHandler(IBookDbContext context) { _context = context; }
public BookUnitOfWork(IBookDbContext context) { _context = context; }
public BookUnitOfWork() { _context = new BookDbContext(); }
public BookUnitOfWork(IBookDbContext context) { _context = context; }
public BookUnitOfWork() { _context = new BookDbContext(); }