public void TestGetAllMagazines()
        {
            // Arrange
            _magazineRepository = new MagazineRepository();

            // Act
            var result = _magazineRepository.GetAllMagazines();
            var count  = result.Count;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(6, count);
        }
Example #2
0
        public LibraryService()
        {
            _authorRepository   = new AuthorRepository();
            _bookRepository     = new BookRepository();
            _magazineRepository = new MagazineRepository();

            //fill all models from data
            _authorsList   = _authorRepository.GetAllAuthors();
            _booksList     = _bookRepository.GetAllBooks();
            _magazinesList = _magazineRepository.GetAllMagazines();

            //fill authors data from author data into author objects in books and magazines
            _booksList.ForEach(m => m.Authors.ForEach(a => a.FillAuthorName(_authorsList.FirstOrDefault(f => f.Email == a.Email)?.FullName)));
            _magazinesList.ForEach(m => m.Authors.ForEach(a => a.FillAuthorName(_authorsList.FirstOrDefault(f => f.Email == a.Email)?.FullName)));
        }