/// <summary> /// Initializes a new instance of the <see cref="FileApi"/> class. /// </summary> /// <param name="apiClient"> an instance of ApiClient (optional) /// <returns></returns> public FileApi(ApiClient apiClient = null) { if (apiClient == null) { // use the default one in Configuration this.apiClient = Configuration.apiClient; } else { this.apiClient = apiClient; } }
public static void ClassInit(TestContext context) { client = new ApiClient("https://platform.systran.net:8904"); Configuration.apiClient = client; if (!File.Exists("../../apiKey.txt")) throw new Exception("To properly run the tests, please add an apiKey.txt file containing your api key in the SystranClientMultimodalApiLibTests folder or edit the test file with your key"); Dictionary<String, String> keys = new Dictionary<String, String>(); string key; using (StreamReader streamReader = new StreamReader("../../apiKey.txt", Encoding.UTF8)) { key = streamReader.ReadToEnd(); } keys.Add("key", key); Configuration.apiKey = keys; Configuration.apiKey = keys; if (keys.Count == 0) throw new Exception("No api key found, please check your apiKey.txt file"); Configuration.apiKey = keys; fileApi = new FileApi(Configuration.apiClient); }