public async Task Should_Disable_Device() { const string path = "/api/users/disableDevice"; var request = new DisableDeviceRequest { UserId = "*****@*****.**", Email = "*****@*****.**" }; MockRestClient.Setup(m => m.PostAsync <DisableDeviceResponse>(It.Is <string>(a => a == path), It.IsAny <DisableDeviceRequest>())).ReturnsAsync(new ApiResponse <DisableDeviceResponse> { UrlPath = path, HttpStatusCode = HttpStatusCode.OK, Model = new DisableDeviceResponse { Code = "Success" } }); ApiResponse <DisableDeviceResponse> response = await _userClient.DisableDeviceAsync(request).ConfigureAwait(false); Assert.NotNull(response); Assert.NotNull(response.Model); Assert.Equal("Success", response.Model.Code); Assert.Equal(HttpStatusCode.OK, response.HttpStatusCode); Assert.Equal(path, response.UrlPath); MockRestClient.Verify(m => m.PostAsync <DisableDeviceResponse>(It.Is <string>(a => a == path), It.IsAny <DisableDeviceRequest>()), Times.Once); }
public async Task <ApiResponse <DisableDeviceResponse> > DisableDeviceAsync(DisableDeviceRequest model) { Ensure.ArgumentNotNull(model, nameof(model)); return(await _client.PostAsync <DisableDeviceResponse>("/api/users/disableDevice", model).ConfigureAwait(false)); }