コード例 #1
0
        public void Should_load_attandance_load_formulas()
        {
            var attData = new AttendanceData {
                Regular = 1, Remark = 2
            };
            var attFormula = new AttendanceFormula {
                OT = "iif(Regular=2,1,2)", OT1 = "iif(Regular=1 && Remark=2,1,2)"
            };
            AttendanceCalculationResult result = calc.Calculate(attFormula, attData);

            Assert.AreEqual(2, result.OT);
            Assert.AreEqual(1, result.OT1);
        }
コード例 #2
0
        public void Should_calcuate_absent_day()
        {
            var attData = new AttendanceData {
                Classification = "CLS01", Regular = 1, Remark = 3
            };
            var attFormula = new AttendanceFormula {
                AbsentDay = mAbsenDayFormula, OT = "iif(Regular=2,1,2)", OT1 = "iif(Regular=1 && Remark=2,1,2)"
            };
            var classMock = new Mock <IAttendanceClassification>();

            classMock.Setup(m => m.LoadFormulasById("CLS01")).Returns(attFormula);
            AttendanceCalculationResult result = calc.Calculate(classMock.Object, attData);

            Assert.AreEqual(0.5, result.AbsentDay);
        }
コード例 #3
0
        public void Should_load_attandance_load_formulas()
        {
            var attData = new AttendanceData {
                Classification = "CLS01", Regular = 1, Remark = 2
            };
            var attFormula = new AttendanceFormula {
                OT = "iif(Regular=2,1,2)", OT1 = "iif(Regular=1 && Remark=2,1,2)"
            };
            var classMock = new Mock <IAttendanceClassification>();

            classMock.Setup(m => m.LoadFormulasById("CLS01")).Returns(attFormula);
            AttendanceCalculationResult result = calc.Calculate(classMock.Object, attData);

            Assert.AreEqual(2, result.OT);
            Assert.AreEqual(1, result.OT1);
        }