using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using HttpClient = NucuCar.Common.HttpClient; namespace NucuCar.UnitTests.NucuCar.Common.Tests { public class MockHttpClient : HttpClient { public List SendAsyncArgCalls; public List SendAsyncResponses; private int _sendAsyncCallCounter; public MockHttpClient(string baseAddress) : base(baseAddress) { _sendAsyncCallCounter = 0; SendAsyncArgCalls = new List(); SendAsyncResponses = new List(); } public override Task SendAsync(HttpRequestMessage requestMessage) { SendAsyncArgCalls.Add(requestMessage); var response = SendAsyncResponses[_sendAsyncCallCounter]; _sendAsyncCallCounter += 1; return Task.FromResult(response); } } }