Exemple #1
0
        public override void Define()
        {
            SalesOrder salesOrder = null;

            When()
            .Match <SalesOrder>(() => salesOrder, so => so.OrderProgressTypeId == OrderProgressStatus.CONFIRMED && !so.IsBulkOrder);
            Then()
            .Do(ctx => salesOrder.CheckBalance())
            .Do(ctx => ctx.Update(salesOrder))
            .Do(ctx => new LogHelper().Log(salesOrder.SalesOrderName + " has been processed by BalanceCheckingRule"));
        }
        /*
         * WHEN
         *  OrderProgressStatus.CONFIRMED
         * THEN
         *  Check Balance, see if need to cancel the order
         *
         */

        public override void Define()
        {
            SalesOrder salesOrder = null;

            When()
            .Match <SalesOrder>(() => salesOrder, s => false && s.OrderProgressTypeId == OrderProgressStatus.CONFIRMED);

            Then()
            .Do(ctx => salesOrder.CheckBalance())    //cancelled
            .Do(ctx => ctx.Update(salesOrder))
            .Do(ctx => new LogHelper().Log("test2"))
            ;
        }