public void CreateSendMessageToChannelRequestThrowsOnNullArguments() { var requestFactory = new RequestFactory("apiKey", "secretKey", "http://example.com"); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToChannelRequest(null, "message")); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToChannelRequest(string.Empty, "message")); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToChannelRequest("name", null)); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToChannelRequest("name", string.Empty)); }
public void CreateSendMessageToChannelRequestReturnsCorrectRequest() { var baseUrl = "http://example.com"; var apiKey = "apiKey"; var secretKey = "secretKey"; var requestFactory = new RequestFactory(apiKey, secretKey, baseUrl); var request = requestFactory.CreateSendMessageToChannelRequest("name", "message"); request.AssertCorrectSecret(secretKey); request.AssertCorrectContentType(); request.AssertCorrectMethod(HttpVerb.POST); request.AssertCorrectUrl(baseUrl, apiKey, "channels/name"); Assert.That(request.Body, Is.EqualTo("message")); }