public void OrderRefundController_Delete_ShouldReturnPassedOrderRefundAsModel()
        {
            var item = new OrderRefund();

            var delete = _orderRefundController.Delete(item);

            delete.Model.Should().Be(item);
        }
        public void OrderRefundController_DeletePOST_ShouldCallDeleteForThePassedOrderRefund()
        {
            var item = new OrderRefund();
            item.Order = new Order { Id = 1 };

            var delete = _orderRefundController.Delete_POST(item);

            A.CallTo(() => _orderRefundService.Delete(item)).MustHaveHappened();
        }
        public void OrderRefundController_DeletePOST_RedirectsToEditOrderForTheIdOfOrder()
        {
            var orderRefund = new OrderRefund();
            orderRefund.Order = new Order { Id = 1 };

            var delete = _orderRefundController.Delete_POST(orderRefund);

            delete.RouteValues["action"].Should().Be("Edit");
            delete.RouteValues["controller"].Should().Be("Order");
            delete.RouteValues["id"].Should().Be(1);
        }
Пример #4
0
        public void Add(OrderRefund orderRefund)
        {
            orderRefund.Order.OrderRefunds.Add(orderRefund);//cache
            _session.Transact(session => session.Save(orderRefund));

            if (orderRefund.Amount == orderRefund.Order.Total)
                EventContext.Instance.Publish<IOnOrderFullyRefunded, OrderFullyRefundedArgs>
                    (new OrderFullyRefundedArgs {Refund = orderRefund, Order = orderRefund.Order});
            else
                EventContext.Instance.Publish<IOnOrderPartiallyRefunded, OrderPartiallyRefundedArgs>
                    (new OrderPartiallyRefundedArgs { Refund = orderRefund, Order = orderRefund.Order });
        }
Пример #5
0
        public void OrderRefundService_Add_ShouldCallOrderFullyRefunded()
        {
            var order = new Order {Total = 100};
            var orderRefund = new OrderRefund {Amount = 100, Order = order};

            _orderRefundService.Add(orderRefund);

            A.CallTo(
                () =>
                   EventContext.FakeEventContext.Publish<IOnOrderFullyRefunded, OrderFullyRefundedArgs>(
                        A<OrderFullyRefundedArgs>.That.Matches(args => args.Order == order))).MustHaveHappened();
        }
Пример #6
0
 public void Delete(OrderRefund item)
 {
     _session.Transact(session => session.Delete(item));
 }