private ExcelImportService SetupImportService(Exception exception, Action<object, ImportDataFailedEventArgs> eventHandler) { var excelImporter = new Mock<IExcelImport>(); excelImporter.Setup(i => i.GetRowsAsKeyValuePairs(0)).Throws(exception); var importService = new ExcelImportService(excelImporter.Object); importService.ImportFailed += eventHandler; return importService; }
private ExcelImportService SetupImportService(IEnumerable<IDictionary<string, object>> dataToImport, Action<object, ImportDataCompletedEventArgs> eventHandler = null) { var excelImporter = new Mock<IExcelImport>(); excelImporter.Setup(i => i.GetRowsAsKeyValuePairs(0)).Returns(dataToImport); var importService = new ExcelImportService(excelImporter.Object); importService.ImportCompleted += eventHandler; return importService; }