コード例 #1
0
        public void OfflinePayment()
        {
            _order.Status = OrderStatus.OfflinePayment;
            OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs {
                OrderInfo = _order, OrderStatus = OrderStatus.OfflinePayment, SendEmails = false
            });

            _stockServiceMock.Verify(m => m.SetStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>()));
            Assert.IsTrue(_order.StockUpdated);
        }
コード例 #2
0
        public void OnlinePaymentAndCancelling()
        {
            _order.PaymentInfo.PaymentType = PaymentProviderType.OnlinePayment;
            _order.Status = OrderStatus.ReadyForDispatch;
            OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs {
                OrderInfo = _order, OrderStatus = OrderStatus.ReadyForDispatch, SendEmails = false
            });

            _stockServiceMock.Verify(m => m.SetStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>()));
            Assert.IsTrue(_order.StockUpdated);

            _order.Status = OrderStatus.Cancelled;
            OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs {
                OrderInfo = _order, OrderStatus = OrderStatus.Cancelled, SendEmails = false
            });

            _stockServiceMock.Verify(m => m.ReturnStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>()));
            Assert.IsFalse(_order.StockUpdated);
        }