public void Test_Post_POSTするときのMediaTypeがjsonであること() { var uri = new Uri("https://tomoprogsample.com"); IMattermostText textBuilder = new DummyTestBuilder(); var service = new MattermostWebhookService(uri, textBuilder, _client); var response = service.Post(); Assert.AreEqual(@"application/json", response.RequestMessage.Content.Headers.ContentType.MediaType); }
public void Test_Post_指定したURLにPOSTしていること() { var uri = new Uri("https://tomoprogsample.com"); IMattermostText textBuilder = new DummyTestBuilder(); var service = new MattermostWebhookService(uri, textBuilder, _client); var response = service.Post(); Assert.AreEqual(HttpMethod.Post, response.RequestMessage.Method); Assert.AreEqual(uri, response.RequestMessage.RequestUri); }
public void Test_Post_text属性には指定したクラスのBuildメソッドの内容が入ること() { var uri = new Uri("https://tomoprogsample.com"); IMattermostText textBuilder = new DummyTestBuilder(); var service = new MattermostWebhookService(uri, textBuilder, _client); var response = service.Post(); var content = response.RequestMessage.Content.ReadAsStringAsync().Result; var expected = string.Format(@"{{""text"":""{0}""}}", textBuilder.Build()); Assert.AreEqual(expected, content); }