public AdminController(JournalsImport journalsImport, UlrichsImport ulrichsImport, DoajImport doajImport, JournalTocsImport journalsTocImport, JournalsExport journalsExport, IJournalRepository journalRepository, IUserProfileRepository userProfileRepository, IAuthentication authentication, IInstitutionRepository institutionRepository, IBlockedISSNRepository blockedIssnRepository, IBaseScoreCardRepository baseScoreCardRepository, IValuationScoreCardRepository valuationScoreCardRepository, IBulkImporter<SubmissionPageLink> bulkImporter, IBulkImporter<Institution> institutionImporter) : base(baseScoreCardRepository, valuationScoreCardRepository, userProfileRepository, authentication) { Requires.NotNull(journalsImport, nameof(journalsImport)); Requires.NotNull(ulrichsImport, nameof(ulrichsImport)); Requires.NotNull(journalsTocImport, nameof(journalsTocImport)); Requires.NotNull(doajImport, nameof(doajImport)); Requires.NotNull(journalsExport, nameof(journalsExport)); Requires.NotNull(journalRepository, nameof(journalRepository)); Requires.NotNull(institutionRepository, nameof(institutionRepository)); Requires.NotNull(blockedIssnRepository, nameof(blockedIssnRepository)); Requires.NotNull(bulkImporter, nameof(bulkImporter)); Requires.NotNull(institutionImporter, nameof(institutionImporter)); this.journalsImport = journalsImport; this.ulrichsImport = ulrichsImport; this.doajImport = doajImport; _journalsTocImport = journalsTocImport; this.journalsExport = journalsExport; this.journalRepository = journalRepository; this.institutionRepository = institutionRepository; this.blockedIssnRepository = blockedIssnRepository; _bulkImporter = bulkImporter; _institutionImporter = institutionImporter; }
public void ExportAllJournalsWithNullStreamThrowsArgumentNullException() { // Arrange var journalsExport = new JournalsExport(Mock.Of<IJournalRepository>()); Stream nullStream = null; // Act // Assert Assert.Throws<ArgumentNullException>(() => journalsExport.ExportAllJournals(nullStream)); }
public void ExportAllJournalsExportAllJournalsInCorrectCsvFormat() { // Arrange var mockJournalRepository = new Mock<IJournalRepository>(); mockJournalRepository.Setup(j => j.AllIncluding(It.IsAny<Expression<Func<Journal, object>>[]>())).Returns(CreateJournals()); var journalsExport = new JournalsExport(mockJournalRepository.Object); var memoryStream = new MemoryStream(); // Act journalsExport.ExportAllJournals(memoryStream); // Assert var csvContent = Encoding.Default.GetString(memoryStream.ToArray()); Assert.Equal(ExpectedJournalsCsv, csvContent); }
public AdminController(JournalsImport journalsImport, UlrichsImport ulrichsImport, DoajImport doajImport, JournalsExport journalsExport, IJournalRepository journalRepository, IUserProfileRepository userProfileRepository, IAuthentication authentication, IInstitutionRepository institutionRepository) : base(userProfileRepository, authentication) { Requires.NotNull(journalsImport, "journalsImport"); Requires.NotNull(ulrichsImport, "ulrichsImport"); Requires.NotNull(doajImport, "doajImport"); Requires.NotNull(journalsExport, "journalsExport"); Requires.NotNull(journalRepository, "journalRepository"); Requires.NotNull(institutionRepository, "institutionRepository"); this.journalsImport = journalsImport; this.ulrichsImport = ulrichsImport; this.doajImport = doajImport; this.journalsExport = journalsExport; this.journalRepository = journalRepository; this.institutionRepository = institutionRepository; }
private AdminController CreateAdminController(JournalsExport journalsExport) { return new AdminController(CreateJournalsImport(), this.CreateUlrichsClient(), CreateDoajImport(), journalsExport, Mock.Of<IJournalRepository>(), Mock.Of<IUserProfileRepository>(), Mock.Of<IAuthentication>(), Mock.Of<IInstitutionRepository>()); }