public void TestPrepareRequest() { const string apiKey = "apiKey"; ClientManager.SetCurrent(apiKey); Request request = new Request("resource"); List <String> parameters = ClientManager.Build().PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); #if NET35 string user_agent = string.Concat("EasyPost/v2 CSharp (.NET 3.5)/", ClientManager.Build().version); #elif NET40 string user_agent = string.Concat("EasyPost/v2 CSharp (.NET 4.0)/", ClientManager.Build().version); #elif NETCORE31 string user_agent = string.Concat("EasyPost/v2 CSharp (.NET Core 3.1)/", ClientManager.Build().version); #else string user_agent = string.Concat("EasyPost/v2 CSharp (.NET 4.5.2)/", ClientManager.Build().version); #endif #if DEBUG user_agent += " [DEBUG]"; #endif CollectionAssert.Contains(parameters, "user_agent=" + user_agent); CollectionAssert.Contains(parameters, "authorization=Bearer " + apiKey); CollectionAssert.Contains(parameters, "content_type=application/json"); }
public void TestFactoryDelegate() { ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); Client client = ClientManager.Build(); Assert.AreEqual("apiKey", client.configuration.ApiKey); }
public void TestApiKey() { ClientManager.SetCurrent("apiKey"); Client client = ClientManager.Build(); Assert.AreEqual("apiKey", client.configuration.ApiKey); }
public void TestFactoryDelegateForUniqueObjects() { ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); Client client1 = ClientManager.Build(); Client client2 = ClientManager.Build(); Assert.AreNotSame(client1, client2); }
public void TestApiKeyForUniqueObjects() { ClientManager.SetCurrent("apiKey"); Client client1 = ClientManager.Build(); Client client2 = ClientManager.Build(); Assert.AreNotSame(client1, client2); }
public static async Task <ItemFactoryBuilder> CreateAsync(bool refreshCitadelData) { await ClientManager.Build(); var marketApi = new MarketApi(); var citadelManager = await CitadelObtainer.BuildAsync(marketApi, refreshCitadelData); var itemManager = new GeneralItemManager(); return(new ItemFactoryBuilder(citadelManager, new BlueprintService(new BlueprintManager(), itemManager), itemManager.GetItemName, itemManager.GetItemId, new MaterialsService())); }
public void TestPrepareRequest() { const string apiKey = "apiKey"; ClientManager.SetCurrent(apiKey); Request request = new Request("resource"); List <String> parameters = ClientManager.Build().PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); CollectionAssert.Contains(parameters, "user_agent=EasyPost/v2 CSharp/" + ClientManager.Build().version); CollectionAssert.Contains(parameters, "authorization=Bearer " + apiKey); CollectionAssert.Contains(parameters, "content_type=application/json"); }
public void TestNotConfigured() { ClientManager.Build(); }