Пример #1
0
        public void 使用ExpressionTree_調用兩個參數的SetMethod方法_預期得到AOPException()
        {
            var    bo     = new BO();
            Action action = () => AOPLoader.Invoke(bo, () => bo.SetMethod("余小章", "可惡出錯了!"));

            action.ShouldThrow <AOPException>();
        }
Пример #2
0
        public void 使用ExpressionTree_調用GetSquare方法_參數2_預期得到4()
        {
            var bo       = new BO();
            var expected = 4;
            var actual   = (int)AOPLoader.Invoke(bo, () => bo.GetSquare(2));

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        /// <summary>
        ///     計算薪資
        /// </summary>
        /// <param name="WorkHours">工時</param>
        /// <param name="Hourly">時薪</param>
        /// <param name="PrivateDayOff">請假天數</param>
        /// <returns></returns>
        public float Calculate(float WorkHours, int Hourly, int PrivateDayOffHours)
        {
            float result = 0;

            result = (float)AOPLoader.Invoke(this._SalaryFormula,
                                             () => this._SalaryFormula.Execute(WorkHours, Hourly,
                                                                               PrivateDayOffHours));
            return(result);
        }