public async Task TrackAndTraceTestIntegration() { var builder = new ConfigurationBuilder() .AddUserSecrets <PostnordTest>(); Configuration = builder.Build(); var client = new PostnordTrackAndTraceClient(new System.Net.Http.HttpClient()); var response = await client.RestShipmentV2TrackandtraceFindByIdentifierByReturntypeGetAsync(Returntype2.Json, Configuration["PostnordAPIKey"], "373303810003399402"); Assert.AreEqual(1, response.TrackingInformationResponse.Shipments.Count); }
public async Task TrackAndTraceTest() { Mock <HttpMessageHandler> handlerMock = Setup(File.ReadAllText("200.json")); var builder = new ConfigurationBuilder() .AddUserSecrets <PostnordTest>(); Configuration = builder.Build(); var client = new PostnordTrackAndTraceClient(new System.Net.Http.HttpClient(handlerMock.Object)); var response = await client.RestShipmentV2TrackandtraceFindByIdentifierByReturntypeGetAsync(Returntype2.Json, Configuration["PostnordAPIKey"], "373303810003399402"); Assert.AreEqual(1, response.TrackingInformationResponse.Shipments.Count); Verify(handlerMock); }
public TrackAndTraceService(PostnordTrackAndTraceClient client, string apiKey) { this.client = client; this.apiKey = apiKey; }
public TrackAndTraceService() { this.client = new Postnord.API.PostnordTrackAndTraceClient(new System.Net.Http.HttpClient()); this.apiKey = Environment.GetEnvironmentVariable("PostnordAPIKey"); }