Exemplo n.º 1
0
 private string MakeAnnouncementResponse(string eventName)
 {
     if (eventName == "merchant.order.status.changed")
     {
         return(MerchantOrderResponseBuilder.NewInstanceAsJson());
     }
     throw new Exception("Unknown announcement type");
 }
Exemplo n.º 2
0
        public void TestAnnounceOrder()
        {
            var order            = MerchantOrderRequestBuilder.MakeCompleteRequest();
            var orderAsJson      = JsonHelper.Serialize(order);
            var expectedResponse = MerchantOrderResponseBuilder.NewInstanceAsJson();

            PrepareTokenProviderWithAccessToken(_accessToken);
            _restTemplate.Setup(s => s.Post("order/server/api/order", orderAsJson)).Returns(expectedResponse);

            var actualResponse = _connector.AnnounceMerchantOrder(order);

            _restTemplate.Verify(v => v.SetToken(_accessToken.Token));
            _restTemplate.Verify(v => v.Post("order/server/api/order", orderAsJson));

            Assert.AreEqual(expectedResponse, actualResponse);
        }