public void Setup() { Mock <ITokenHubClient> tokenHubClient = new Mock <ITokenHubClient>(); Mock <IMapper> mapper = new Mock <IMapper>(); Mock <IHttpClientFactory> _httpClientFactory = new Mock <IHttpClientFactory>(); _httpClientFactory.Setup(x => x.CreateClient(It.IsAny <string>())) .Returns(TicketHelperTest.GetHttpClient()); var customerHub = new CustomerHubClientTests(); customerHub.Setup(); if (customerHub.CustomerHubClient.SearchAsync(null).TryExecute(out var customers)) { CustomerId = customers.Results.Select(x => x.Id).FirstOrDefault(); } tokenHubClient.Setup(x => x.GetTicketAsync()) .Returns(Task.FromResult(new Ticket() { AccessToken = "TEST-8600607042428103-060407-f91bbb3d5d0029bc342657a83aa08ee5-397002962" })); _PaymentHubClient = new PaymentHubClient(mapper.Object, _httpClientFactory.Object, TicketHelperTest.GetMPOptions(), tokenHubClient.Object); }
public void Setup() { Mock <IHttpClientFactory> _httpClientFactory = new Mock <IHttpClientFactory>(); _httpClientFactory.Setup(x => x.CreateClient(It.IsAny <string>())) .Returns(TicketHelperTest.GetHttpClient()); _tokenHubClient = new TokenHubClient(_httpClientFactory.Object, TicketHelperTest.GetMPOptions()); }
public void Setup() { Mock <ITokenHubClient> tokenHubClient = new Mock <ITokenHubClient>(); Mock <IHttpClientFactory> _httpClientFactory = new Mock <IHttpClientFactory>(); _httpClientFactory.Setup(x => x.CreateClient(It.IsAny <string>())) .Returns(TicketHelperTest.GetHttpClient()); tokenHubClient.Setup(x => x.GetTicketAsync()) .Returns(Task.FromResult(new Ticket() { AccessToken = "TEST-8600607042428103-060407-f91bbb3d5d0029bc342657a83aa08ee5-397002962" })); CustomerHubClient = new CustomerHubClient(_httpClientFactory.Object, TicketHelperTest.GetMPOptions(), tokenHubClient.Object); }