public FileGenerationService(IMailService mailService, ITransferToPayrollService transferToPayrollService, IGenericRepository <MailNotificationSchedule> mailRepo, IGenericRepository <FileGenerationSchedule> fileRepo, ILogger logger) { _mailService = mailService; _transferToPayrollService = transferToPayrollService; _mailRepo = mailRepo; _fileRepo = fileRepo; _logger = logger; }
public DriveReportsController(IServiceProvider provider) : base(provider) { _driveService = provider.GetService <IDriveReportService>(); //_employmentRepo = provider.GetService<IGenericRepository<Employment>>(); //_personRepo = provider.GetService<IGenericRepository<Person>>(); //_orgrepo = provider.GetService<IGenericRepository<OrgUnit>>(); //_Bankrepo = provider.GetService<IGenericRepository<BankAccount>>(); //_LicensePlateRepo = provider.GetService<IGenericRepository<LicensePlate>>(); _transferToPayrollService = provider.GetService <ITransferToPayrollService>(); }
public void Setup() { var idCounter = 0; _reportList = new List <DriveReport>(); _reportRepoMock = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >(); _reportRepoMock.Insert(new DriveReport()).ReturnsForAnyArgs(x => x.Arg <DriveReport>()).AndDoes(x => _reportList.Add(x.Arg <DriveReport>())).AndDoes(x => x.Arg <DriveReport>().Id = idCounter).AndDoes(x => idCounter++); _reportRepoMock.AsQueryable().ReturnsForAnyArgs(_reportList.AsQueryable()); _reportGeneratorMock = NSubstitute.Substitute.For <IReportGenerator>(); var writerMock = new FileWriterMock(); _reportGeneratorMock = new ReportGenerator(_reportRepoMock, writerMock, new Logger(), new CustomSettings()); _sdClientMock = NSubstitute.Substitute.For <ISdClient>(); _loggerMock = NSubstitute.Substitute.For <ILogger>(); _customSettingsMock = NSubstitute.Substitute.For <ICustomSettings>(); _customSettingsMock.SdIsEnabled.ReturnsForAnyArgs(true); _customSettingsMock.SdUsername.ReturnsForAnyArgs("usernametest"); _customSettingsMock.SdPassword.ReturnsForAnyArgs("passwordtest"); _customSettingsMock.SdInstitutionNumber.ReturnsForAnyArgs("institutionnumbertest"); _loggerMock = NSubstitute.Substitute.For <ILogger>(); _transferToPayRollService = new TransferToPayrollService(_reportGeneratorMock, _reportRepoMock, _sdClientMock, _loggerMock, _customSettingsMock); }