private string MakeAnnouncementResponse(string eventName) { if (eventName == "merchant.order.status.changed") { return(MerchantOrderResponseBuilder.NewInstanceAsJson()); } throw new Exception("Unknown announcement type"); }
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); }