public TaxCalculatorService(IEmployeeRepository employeeRepository, ITaxCalculator calculator, IPayslipGenerator generator, ILogger logger) { Repository = employeeRepository; Calculator = calculator; Generator = generator; Logger = logger; }
public void ReadFromFileTest() { IPayslipGenerator pg = ServiceProvider.GetPayslipGenerator(); pg.ReadFromFile("import/test1.csv"); Assert.AreEqual(2, pg.GetEmployeeRecordsLoadedCount()); }
public void ProcessedRecordTest() { IPayslipGenerator pg = ServiceProvider.GetPayslipGenerator(); pg.ReadFromFile("import/test1.csv"); pg.Process(); Assert.AreEqual(2, pg.GetPayslipsGeneratedCount()); }
private static void Main(string[] args) { var options = new Options(); IPayslipGenerator pg = ServiceProvider.GetPayslipGenerator(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { // Values are available here if (options.Verbose) { Console.WriteLine($"Input Mode: {options.InputMode}"); Console.WriteLine($"Input File: {options.InputFile}"); Console.WriteLine($"Output Mode: {options.OutputFile}"); Console.WriteLine($"Output File: {options.OutputMode}"); } //TODO Could do with better validation around the input parameters. if (options.InputMode.ToLower().Equals("console")) { pg.ReadFromConsole(); } if (options.InputMode.ToLower().Equals("file")) { if (!String.IsNullOrEmpty(options.InputFile)) { pg.ReadFromFile(options.InputFile); } } pg.Process(); if (pg.GetPayslipsGeneratedCount() > 0) { if (options.OutputMode.ToLower().Equals("console")) { pg.WriteToConsole(); } if (options.OutputMode.ToLower().Equals("file")) { if (!String.IsNullOrEmpty(options.OutputFile)) { pg.WriteToFile(options.OutputFile); } } } } }
public PayslipGeneratorTest() { _payslipGenerator = new PayslipGenrator(new TaxService()); }
//public PayslipController(IPayslipGenerator payslipGenerator, ITaxService taxService) //{ // _payslipGenrator = new PayslipGenrator(new TaxService()); //} public PayslipController() { //This needs to be injected through the constructor but for this test we are creating new object _payslipGenrator = new PayslipGenrator(new TaxService()); }
public Application(IDataImporter dataImporter, IPayslipGenerator payslipGenerator) { _dataImporter = dataImporter; _payslipGenerator = payslipGenerator; }
public PayslipGeneratorConsole(IInputReader inputReader, IOutputWriter outputWriter, IPayslipGenerator payslipGenerator) { _inputReader = inputReader; _outputWriter = outputWriter; _payslipGenerator = payslipGenerator; }
public void Setup() { _payslipGenerator = new PayslipGenerator(); }