Beispiel #1
0
        public void Setup()
        {
            _oc       = Substitute.For <IOrderCloudClient>();
            _settings = Substitute.For <AppSettings>();
            _settings.CardConnectSettings = new OrderCloudIntegrationsCardConnectConfig
            {
                UsdMerchantID = "mockUsdMerchantID",
                CadMerchantID = "mockCadMerchantID",
                EurMerchantID = "mockEurMerchantID"
            };
            _settings.OrderCloudSettings = new OrderCloudSettings
            {
                IncrementorPrefix = "SEB"
            };
            _card = Substitute.For <ICreditCardCommand>();
            _card.AuthorizePayment(Arg.Any <OrderCloudIntegrationsCreditCardPayment>(), "mockUserToken", Arg.Any <string>())
            .Returns(Task.FromResult(new Payment {
            }));

            _oc.Orders.PatchAsync(OrderDirection.Incoming, "mockOrderID", Arg.Any <PartialOrder>()).Returns(Task.FromResult(new Order {
                ID = "SEB12345"
            }));
            _oc.AuthenticateAsync().Returns(Task.FromResult(new TokenResponse {
                AccessToken = "mockToken"
            }));
            _oc.Orders.SubmitAsync <HSOrder>(Arg.Any <OrderDirection>(), Arg.Any <string>(), Arg.Any <string>()).Returns(Task.FromResult(new HSOrder {
                ID = "submittedorderid"
            }));
            _sut = new OrderSubmitCommand(_oc, _settings, _card); // sut is subject under test
        }
 public OrderController(IOrderCommand command, ILineItemCommand lineItemCommand, IOrderSubmitCommand orderSubmitCommand)
 {
     _command            = command;
     _lineItemCommand    = lineItemCommand;
     _orderSubmitCommand = orderSubmitCommand;
 }
Beispiel #3
0
 public OrderController(IOrderCommand command, ILineItemCommand lineItemCommand, AppSettings settings, IOrderSubmitCommand orderSubmitCommand) : base(settings)
 {
     _command            = command;
     _lineItemCommand    = lineItemCommand;
     _orderSubmitCommand = orderSubmitCommand;
 }