/// <summary> /// Initialize a new instance of <see cref="BookListService"/> /// </summary> /// <param name="bookRepository">Books storage</param> public BookListService(IBookRepository bookRepository) { if (bookRepository == null) { BookLogger.Fatal($"{nameof(bookRepository)} is null value"); throw new ArgumentNullException(nameof(bookRepository)); } this._bookRepository = bookRepository; BookLogger.Debug($"{nameof(BookListService)} was created"); }
/// <summary> /// Gets instance of books storage /// </summary> /// <param name="fileStorage">Source file name</param> public BookListStorage(string fileStorage) { if (string.IsNullOrWhiteSpace(fileStorage)) { throw new ArgumentNullException($"{nameof(fileStorage)}"); } this._fileStorage = fileStorage; this._listBooks = this.Load(); if (_listBooks == null) { BookLogger.Fatal($"{nameof(BookListStorage)} wasn't created"); throw new ArgumentNullException(nameof(_listBooks)); } BookLogger.Debug($"{nameof(BookListStorage)} was created"); }