public void SetUp() { Books = new Collection <Book> { DefaultData.Books.JsPocketGuide, DefaultData.Books.JsForProfessionals, DefaultData.Books.JsOptimizingPerfomance, DefaultData.Books.Es6AndNotOnly, DefaultData.Books.ClrVia, DefaultData.Books.MyEvernoteNotes, DefaultData.Books.WithoutAuthorsBook, DefaultData.Books.CSharpCompleteGuide, DefaultData.Books.CSharp6AndNetPlatform, DefaultData.Books.AsyncProgrammingCSharp5 }; Authors = new Collection <Author>() { DefaultData.Authors.Devis, DefaultData.Authors.Ferguson, DefaultData.Authors.Flenagan, DefaultData.Authors.Jepkins, DefaultData.Authors.Rezig, DefaultData.Authors.Rihter, DefaultData.Authors.Shildt, DefaultData.Authors.Simpson, DefaultData.Authors.Troelsen, DefaultData.Authors.Yazynin, DefaultData.Authors.Zakas }; Genres = new Collection <Genre>() { DefaultData.Genres.CSharp, DefaultData.Genres.ComputersAndTecnology, DefaultData.Genres.DotNet, DefaultData.Genres.JavaScript, DefaultData.Genres.LanguageAndTools, DefaultData.Genres.MicrosoftProgramming, DefaultData.Genres.Programming, DefaultData.Genres.WebProgramming }; #region Publishers DefaultData.Publishers.Viliams.Books = new List <Book>() { DefaultData.Books.JsPocketGuide, DefaultData.Books.JsForProfessionals, DefaultData.Books.CSharpCompleteGuide, DefaultData.Books.CSharp6AndNetPlatform }; DefaultData.Publishers.Self.Books = new List <Book>() { DefaultData.Books.WithoutAuthorsBook, DefaultData.Books.MyEvernoteNotes }; DefaultData.Publishers.Piter.Books = new List <Book>() { DefaultData.Books.Es6AndNotOnly, DefaultData.Books.ClrVia }; DefaultData.Publishers.DmkPress.Books = new List <Book>() { DefaultData.Books.AsyncProgrammingCSharp5 }; DefaultData.Publishers.SymbolPlus.Books = new List <Book>() { DefaultData.Books.JsOptimizingPerfomance }; Publishers = new Collection <Publisher>() { DefaultData.Publishers.Self, DefaultData.Publishers.DmkPress, DefaultData.Publishers.Piter, DefaultData.Publishers.SymbolPlus, DefaultData.Publishers.Viliams, }; #endregion Invoices = new Collection <Invoice>() { DefaultData.Invoices.First, DefaultData.Invoices.Second, DefaultData.Invoices.Third }; Subscribers = new Collection <Subscriber>() { DefaultData.Subscribers.Petrov, DefaultData.Subscribers.Ivanov, DefaultData.Subscribers.Maslov, DefaultData.Subscribers.Sidorov }; Rents = new Collection <Rent>() { DefaultData.Rents.RentIvanov1, DefaultData.Rents.RentIvanov2, DefaultData.Rents.RentIvanov3, DefaultData.Rents.RentMaslov, DefaultData.Rents.RentMaslov2, DefaultData.Rents.RentMaslov3, DefaultData.Rents.RentMaslov4, DefaultData.Rents.RentMaslov5, DefaultData.Rents.RentPetrov, DefaultData.Rents.RentSidorov, DefaultData.Rents.RentSidorov2, DefaultData.Rents.RentSidorov3, DefaultData.Rents.RentSidorov4, DefaultData.Rents.RentSidorov5, }; var stubBookRepository = new BookRepositoryStub(Books).Get(); var stubAuthorRepository = new AuthorRepositoryStub(Authors).Get(); var stubGenresRepository = GetGenresRepositoryStub(); var stubPublishersRepository = new PublishersRepositoryStub(Publishers).Get(); var stubInvoicesRepository = new InvoicesRepositoryStub(Invoices).Get(); var stubSubscribersRepository = new SubscribersRepositoryStub(Subscribers).Get(); var stubRentsRepository = new RentsRepositoryStub(Rents).Get(); var unitOfWork = Mock.Of <IUnitOfWork>(x => x.BookRepository == stubBookRepository.Object && x.AuthorRepository == stubAuthorRepository.Object && x.GenreRepository == stubGenresRepository.Object && x.PublisherRepository == stubPublishersRepository.Object && x.InvoiceRepository == stubInvoicesRepository.Object && x.SubscriberRepository == stubSubscribersRepository.Object && x.RentRepository == stubRentsRepository.Object); BooksService = new BooksService(unitOfWork); AuthorsService = new AuthorsService(unitOfWork); GenresService = new GenresService(unitOfWork); PublishersService = new PublishersService(unitOfWork); InvoicesService = new InvoicesService(unitOfWork); SubscribersService = new SubscribersService(unitOfWork); RentsService = new RentsService(unitOfWork); ReportsService = new ReportsService(unitOfWork); }
public LibraryController() { repo = new BookRepositoryStub(); }