示例#1
0
        public void On_ReadPayroll_EmptyFolderString_Should_Throw()
        {
            var            folder  = "";
            IPayrollReader subject = new PayrollReader(logger);

            var result = subject.ReadPayroll(folder);
        }
示例#2
0
        public void Can_Create_Payroll_Reader()
        {
            var subject = new PayrollReader(logger);

            subject.Should().NotBeNull();
            subject.Should().BeAssignableTo <IPayrollReader>();
        }
示例#3
0
        public void On_ReadPayroll_InvalidFolder_Should_ReturnNull()
        {
            var            folder  = @"C:\POS\Aloha\20180602";
            IPayrollReader subject = new PayrollReader(logger);

            var result = subject.ReadPayroll(folder);

            result.Should().BeNull();
        }
示例#4
0
        public void On_GetConnectionString_Returns_Correctly_Formatted_String()
        {
            var            folder   = @"C:\POS\Aloha\20180602";
            var            expected = $"Provider=VFPOLEDB.1;Data Source={folder}";
            IPayrollReader subject  = new PayrollReader(logger);

            var result = subject.GetConnectionString(folder);

            result.Should().Be(expected);
        }
示例#5
0
        public void On_ReadPayroll_InvalidFolder_Should_Warn()
        {
            var            logger  = new Mock <ILogger>();
            var            folder  = @"C:\POS\Aloha\20180602";
            IPayrollReader subject = new PayrollReader(logger.Object);

            var result = subject.ReadPayroll(folder);

            logger.Verify(c => c.Warn(It.IsAny <string>()), Times.Once);
        }
示例#6
0
        public void On_ReadPayroll_ValidFolder_Should_ReturnData()
        {
            var            folder  = @"C:\POS\Aloha\20180601";
            IPayrollReader subject = new PayrollReader(logger);

            var result = subject.ReadPayroll(folder);

            result.Should().NotBeNull();
            result.emp.Count.Should().BeGreaterThan(0);
            result.adjtime.Count.Should().BeGreaterThan(0);
            result.gndbreak.Count.Should().BeGreaterThan(0);
        }
        static void Main()
        {
            SetupLogger();

            IPayrollReader    payrollReader    = new PayrollReader(LogManager.GetLogger("PayrollReader"));
            IPayrollConverter payrollConverter = new PayrollConverter(LogManager.GetLogger("PayrollConverter"),
                                                                      new PayrollConverterUtils(LogManager.GetLogger("PayrollConverterUtils")),
                                                                      new EmployeeRepositoryService(LogManager.GetLogger("EmployeeRepositoryService")));
            IPayrollWriter payrollWriter = new PayrollXmlWriter(LogManager.GetLogger("PayrollWriter"));

            IDatedFolderProvider datedFolderProvider = new DatedFolderProvider(new EnvironmentVariableAdapter());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmGeneratePayroll(LogManager.GetLogger("frmGeneratePayroll"), payrollReader, payrollConverter, payrollWriter, datedFolderProvider));
        }