public async Task SendWebRequestAsync_SendGetRequest_IsCorrect() { var response = new Mock <HttpWebResponse>(); response.Setup(c => c.GetResponseStream()).Returns(_responseStream); var request = new Mock <HttpWebRequest>(); request.Setup(c => c.GetResponseAsync()).ReturnsAsync(response.Object); var parameters = new Dictionary <string, object>() { { "param", "test_value" } }; _httpWebRequestFactoryMock.Setup(c => c.Create(It.IsAny <string>(), parameters, "GET")) .Returns(request.Object); var actualRequest = _httpWebRequestFactoryMock.Object.Create("http://www.google.com", parameters, "GET"); string actual; actual = await _requestSender.SendWebRequestAsync <string>("http://www.google.com", "GET", parameters); Assert.IsNotNull(actual); Assert.AreEqual("test value", actual); }
public async Task SendWelcomeMessageAsync(WelcomeMessage welcomeMessage) { Dictionary <string, object> parameters = new Dictionary <string, object>() { { "setting_type", welcomeMessage.SettingType }, { "thread_state", welcomeMessage.ThreadState }, { "call_to_actions", welcomeMessage.CallToActions } }; await _requestsSender.SendWebRequestAsync <string>(Settings.Default.BaseSettingsApiUrl + _token, parameters : parameters); }