예제 #1
0
 public TaxCalculatorService(IEmployeeRepository employeeRepository, ITaxCalculator calculator, IPayslipGenerator generator, ILogger logger)
 {
     Repository = employeeRepository;
     Calculator = calculator;
     Generator  = generator;
     Logger     = logger;
 }
예제 #2
0
        public void ReadFromFileTest()
        {
            IPayslipGenerator pg = ServiceProvider.GetPayslipGenerator();

            pg.ReadFromFile("import/test1.csv");
            Assert.AreEqual(2, pg.GetEmployeeRecordsLoadedCount());
        }
예제 #3
0
        public void ProcessedRecordTest()
        {
            IPayslipGenerator pg = ServiceProvider.GetPayslipGenerator();

            pg.ReadFromFile("import/test1.csv");
            pg.Process();
            Assert.AreEqual(2, pg.GetPayslipsGeneratedCount());
        }
예제 #4
0
        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);
                        }
                    }
                }
            }
        }
예제 #5
0
 public PayslipGeneratorTest()
 {
     _payslipGenerator = new PayslipGenrator(new TaxService());
 }
예제 #6
0
        //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;
 }
예제 #8
0
 public PayslipGeneratorConsole(IInputReader inputReader, IOutputWriter outputWriter, IPayslipGenerator payslipGenerator)
 {
     _inputReader      = inputReader;
     _outputWriter     = outputWriter;
     _payslipGenerator = payslipGenerator;
 }
 public void Setup()
 {
     _payslipGenerator = new PayslipGenerator();
 }