public void CreateForceUserSignOutRequestThrowsOnNullArguments() { var requestFactory = new RequestFactory("apiKey", "secretKey", "http://example.com"); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateForceUserSignOutRequest(null)); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateForceUserSignOutRequest(string.Empty)); }
public void CreateIsUserOnlineRequestReturnsCorrectRequest() { var baseUrl = "http://example.com"; var apiKey = "apiKey"; var secretKey = "secretKey"; var requestFactory = new RequestFactory(apiKey, secretKey, baseUrl); var request = requestFactory.CreateIsUserOnlineRequest("username"); request.AssertCorrectSecret(secretKey); request.AssertCorrectContentType(); request.AssertCorrectMethod(HttpVerb.GET); request.AssertCorrectUrl(baseUrl, apiKey, "users/username"); Assert.That(string.IsNullOrEmpty(request.Body)); }
public void CreateSendMessageToUserRequestThrowsOnNullArguments() { var requestFactory = new RequestFactory("apiKey", "secretKey", "http://example.com"); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToUserRequest(null, "message")); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToUserRequest(string.Empty, "message")); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToUserRequest("username", null)); Assert.Throws<ArgumentNullException>(() => requestFactory.CreateSendMessageToUserRequest("username", string.Empty)); }
public void CreateSendMessageToUserRequestReturnsCorrectRequest() { var baseUrl = "http://example.com"; var apiKey = "apiKey"; var secretKey = "secretKey"; var requestFactory = new RequestFactory(apiKey, secretKey, baseUrl); var request = requestFactory.CreateSendMessageToUserRequest("username", "message"); request.AssertCorrectSecret(secretKey); request.AssertCorrectContentType(); request.AssertCorrectMethod(HttpVerb.POST); request.AssertCorrectUrl(baseUrl, apiKey, "users/username"); Assert.That(request.Body, Is.EqualTo("message")); }