private static BorrowRepository CreateBorrowsRepository(ILendingLibraryContext context = null) { if (context == null) { context = Substitute.For<ILendingLibraryContext>(); } return new BorrowRepository(context); }
public BorrowRepository(ILendingLibraryContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _context = context; }
public BorrowController(IBorrowRepository borrowRepository, IItemRepository itemRepository, IPersonRepository personRepository, ILendingLibraryContext lendingLibraryContext) { if (borrowRepository == null) throw new ArgumentNullException(nameof(borrowRepository)); if (itemRepository == null) throw new ArgumentNullException(nameof(itemRepository)); if (personRepository == null) throw new ArgumentNullException(nameof(personRepository)); if (lendingLibraryContext == null) throw new ArgumentNullException(nameof(lendingLibraryContext)); _borrowRepository = borrowRepository; _itemRepository = itemRepository; _personRepository = personRepository; _lendingLibraryContext = lendingLibraryContext; }
private static ItemRepository CreateItemRepository(ILendingLibraryContext context = null) { if (context == null) { context = Substitute.For<ILendingLibraryContext>(); } return new ItemRepository(context); }
private static ILendingLibraryContext SetContextWithDtos(ILendingLibraryContext context, List<ItemDto> items) { var dbset = new IDbSetSubstituteBuilder<ItemDto>(); var dbSet = dbset.WithDataStore(new ObservableCollection<ItemDto>(items)).Build(); context.Items.Returns(dbSet); return context; }
private static PersonRepository CreatePersonRepository(ILendingLibraryContext dbcontext) { return new PersonRepository(dbcontext); }
private static ILendingLibraryContext SetContextWithDtos(ILendingLibraryContext context, List<PersonDto> people) { var dbset = new IDbSetSubstituteBuilder<PersonDto>(); var dbSet = dbset.WithDataStore(new ObservableCollection<PersonDto>(people)).Build(); context.People.Returns(dbSet); return context; }
public ItemRepository(ILendingLibraryContext lendingLibraryContext) { if (lendingLibraryContext == null) throw new ArgumentNullException(nameof(lendingLibraryContext)); _lendingLibraryContext = lendingLibraryContext; }
private static BorrowController CreateBorrowController(IBorrowRepository borrowR = null, IItemRepository itemR = null, IPersonRepository personR = null, ILendingLibraryContext context = null) { if (borrowR == null) { borrowR = Substitute.For<IBorrowRepository>(); } if (itemR == null) { itemR = Substitute.For<IItemRepository>(); } if (personR == null) { personR = Substitute.For<IPersonRepository>(); } if (context == null) { context = Substitute.For<ILendingLibraryContext>(); } return new BorrowController(borrowR, itemR, personR, context); }