public void Arrange() { _restClientMock = new Mock <IRestClient>(); _restClientMock.Setup(c => c.ExecuteTaskAsync(It.IsAny <IRestRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(GetValidResponse(new [] { new ProviderTestData { Ukprn = 123, Name = "Test", }, })); _messageBuilderMock = new Mock <IUkrlpSoapMessageBuilder>(); _messageBuilderMock.Setup(b => b.BuildMessageToGetUpdatesSince(It.IsAny <DateTime>(), It.IsAny <string>())) .Returns("some-soap-xml-request"); _configuration = new UkrlpApiConfiguration { Url = "https://ukrlp.test.local", StakeholderId = "123", }; _client = new UkrlpSoapApiClient(_restClientMock.Object, _messageBuilderMock.Object, _configuration); }
public void Arrange() { _httpClientMock = new HttpClientMock(); _httpClientMock .SetDefaultResponse(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("<element />", Encoding.UTF8, "text/xml") }); _configuration = new UkrlpApiConfiguration { WebServiceUrl = "http://localhost:1234", StakeholderId = 123, }; _logger = new Mock <ILogger <UkrlpSoapApiClient> >(); _requestSerializer = new Mock <IRequestSerializer>(); _requestSerializer.Setup(serializer => serializer.Serialize(It.IsAny <ProviderQueryRequest>())) .Returns("<unit-test>testing</unit-test>"); _responseDeserializer = new Mock <IResponseDeserializer>(); _responseDeserializer.Setup(deserializer => deserializer.DeserializeResponse(It.IsAny <string>())) .Returns(new Provider[0]); _client = new UkrlpSoapApiClient( _httpClientMock.AsHttpClient(), _configuration, _logger.Object, _requestSerializer.Object, _responseDeserializer.Object); }
public void Arrange() { _restClientMock = new Mock <IRestClient>(); _restClientMock.Setup(c => c.ExecuteTaskAsync(It.IsAny <IRestRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(GetValidResponse(123, "Test")); _messageBuilderMock = new Mock <IUkrlpSoapMessageBuilder>(); _messageBuilderMock.Setup(b => b.BuildMessageToGetSpecificUkprns(It.IsAny <long[]>(), It.IsAny <string>())) .Returns("some-soap-xml-request"); _configuration = new UkrlpApiConfiguration { Url = "https://ukrlp.test.local", StakeholderId = "123", }; _client = new UkrlpSoapApiClient(_restClientMock.Object, _messageBuilderMock.Object, _configuration); }