public void ETSApi_FetchTranslationNoTags_ValidTranslation() { var xliffDocument = new Xliff(engFraLP.SourceCulture, engFraLP.TargetCulture); xliffDocument.AddSourceText(StringResource.BasicText); var translatedXliffText = ETSTranslatorHelper.GetTranslation(apiKeyTranslationOptions, engFraLP, xliffDocument); var translatedXliff = Sdl.Community.Toolkit.LanguagePlatform.XliffConverter.Converter.ParseXliffString(translatedXliffText); Assert.IsTrue(translatedXliff.GetTargetSegments().Any()); Assert.AreEqual( StringResource.BasicTranslation, translatedXliff.GetTargetSegments()[0].ToString()); var token = ETSTranslatorHelper.GetAuthToken(basicAuthTranslationOptions, userCredentials); basicAuthTranslationOptions.ApiToken = token; translatedXliffText = ETSTranslatorHelper.GetTranslation(basicAuthTranslationOptions, engFraLP, xliffDocument); translatedXliff = Sdl.Community.Toolkit.LanguagePlatform.XliffConverter.Converter.ParseXliffString(translatedXliffText); Assert.IsTrue(translatedXliff.GetTargetSegments().Any()); Assert.AreEqual( StringResource.BasicTranslation, translatedXliff.GetTargetSegments()[0].ToString()); }
public void ETSApi_GetBasicAuthToken_GetsToken() { try { var token = ETSTranslatorHelper.GetAuthToken(basicAuthTranslationOptions, userCredentials); if (token == null) { Assert.Fail("Expected token, but got null"); } } catch (Exception ex) { Assert.Fail("Expected no exception, but got: " + ex.Message); } }