public void CreateAsync_WhenProvidedWithRequest_CallsExpectedUrl()
        {
            var httpClient = new MockHttpClient<AccountRegistrationConfirmation>(HttpStatusCode.OK);
            var api = ApiClient.Create<AccountApi, AccountRegistrationConfirmation>(httpClient);
            var request = new CreateAccountRequest();

            api.CreateAsync(request, response => {});

            Assert.That(httpClient.LastRequestedUrl, Is.StringContaining(string.Format("{0}{1}/v{2}/account", TestContext.ApiLocation, TestContext.ApiKey, TestContext.ApiVersion)));
            Assert.That(httpClient.LastRequest.Method, Is.StringContaining("PUT"));
        }
Пример #2
0
        public void CreateAsync(CreateAccountRequest request, Action<string> callback)
		{
			HttpChannel.PutAsync<CreateAccountRequest, AccountRegistrationConfirmation>(ResourceBase, request, response => callback(response.Email));
        }
Пример #3
0
 public string Create(CreateAccountRequest request)
 {
 	return HttpChannel.Put<CreateAccountRequest, AccountRegistrationConfirmation>(ResourceBase, request).Email;
 }