Example #1
0
        public async Task <IActionResult> Calculate([FromBody] CalculateFormulaRequest postRequest)
        {
            var calc = new AttendanceCalculator();
            await calc.LoadCompanyStaticDataAsConstantAsync(mstaticRepo);

            var result = calc.Calculate(postRequest.Formula, await postRequest.Attandance.ToAttendanceDataAsync(mstaticRepo));

            return(Ok(new FormulaCalculatedResponse {
                Result = result
            }));
        }
        public async System.Threading.Tasks.Task InitAsync()
        {
            var staticDataMock = new Mock <IStaticDataRepository>();
            var listOfRemark   = new List <Remark>()
            {
                new Remark(1, "ABSs"),
                new Remark(2, "AL")
            };

            staticDataMock.Setup(m => m.LoadRemarkAsync()).ReturnsAsync(listOfRemark);
            calc = new AttendanceCalculator();
            await calc.LoadCompanyStaticDataAsConstantAsync(staticDataMock.Object);
        }