public BookFacade(IBookRepository bookRepository, IMemberRepository memberRepository, IBookCopyRepository bookCopyRepository, IOrderRepository orderRepository, IOrderLineRepository orderLineRepository)
 {
     _bookRepository      = bookRepository;
     _memberRepository    = memberRepository;
     _bookCopyRepository  = bookCopyRepository;
     _orderRepository     = orderRepository;
     _orderLineRepository = orderLineRepository;
 }
示例#2
0
 public async Task DeleteById(int id)
 {
     await Task.Run(() =>
     {
         IUnitOfWork uow          = this._uowProvider.Get();
         IBookCopyRepository repo = this._repoProvider.Get(uow);
         repo.DeleteById(id);
         uow.Dispose();
     });
 }
示例#3
0
 public async Task Create(BookCopy copy)
 {
     await Task.Run(() =>
     {
         IUnitOfWork uow          = this._uowProvider.Get();
         IBookCopyRepository repo = this._repoProvider.Get(uow);
         repo.Create(copy);
         uow.Dispose();
     });
 }
示例#4
0
 public void Setup()
 {
     _bookCopyRepositoryMock = new Mock <IBookCopyRepository>();
     _bookCopyRepositoryMock
     .WithValidInsert()
     .WithValidDelete()
     .WithValidUpdate()
     .WithValidGet()
     .WithValidGetByIsbn()
     .WithValidInserOrUpdate();
     _bookCopyRepository = _bookCopyRepositoryMock.Object;
     _facade             = new BookCopyFacade(_bookCopyRepository);
 }
示例#5
0
        public async virtual Task <IEnumerable <BookCopy> > GetAll()
        {
            IEnumerable <BookCopy> allCopies = null;
            await Task.Run(() =>
            {
                IUnitOfWork uow          = this._uowProvider.Get();
                IBookCopyRepository repo = this._repoProvider.Get(uow);
                allCopies = repo.ReadAll();
                uow.Dispose();
            });

            return(allCopies);
        }
 public void Setup()
 {
     _bookRepositoryMock      = new Mock <IBookRepository>();
     _memberRepositoryMock    = new Mock <IMemberRepository>();
     _bookCopyRepositoryMock  = new Mock <IBookCopyRepository>();
     _orderRepositoryMock     = new Mock <IOrderRepository>();
     _orderLineRepositoryMock = new Mock <IOrderLineRepository>();
     _bookRepository          = _bookRepositoryMock.Object;
     _memberRepository        = _memberRepositoryMock.Object;
     _bookCopyRepository      = _bookCopyRepositoryMock.Object;
     _orderRepository         = _orderRepositoryMock.Object;
     _orderLineRepository     = _orderLineRepositoryMock.Object;
     _sut = new BookFacade(_bookRepository, _memberRepository, _bookCopyRepository, _orderRepository, _orderLineRepository);
 }
 public BorrowBookService(IMemberService memberService, IBookCopyRepository bookCopyRepository)
 {
     this.memberService      = memberService;
     this.bookCopyRepository = bookCopyRepository;
 }
 public BookCopyFacade(IBookCopyRepository repository)
 {
     _repository = repository;
 }
 public BorrowBookTest()
 {
     this.memberService      = new Mock <IMemberService>();
     this.bookCopyRepository = new BookCopyInMemoryRepository();
     this.borrowBookService  = new BorrowBookService(memberService.Object, bookCopyRepository);
 }