Files
sqltoolsservice/test/Microsoft.Kusto.ServiceLayer.UnitTests/ServiceHost/SrTests.cs
Alex Ma 993b094db9 Localization added to sqlservicetools (#1216)
* added other languages to ServiceLayer

* fixed travis and appveyor yaml, added other languages for localization

* added spanish and german strings to credentialslocalization, also WIP for coreservices test

* added WIP localization test for CoreServices

* Removed unit test for coreservices, need to work on those later.

* restored travis and appveyor

* added kusto string resource localization test

* added localization test and locale change for SqlToolsCredentials

* added locale command options to ResourceProvider

* revert resourceprovider test

* Localized SqlTools.Credentials

* added hosting localization

* replaced new with translation to be consistent with main service layer

* reverted external changes as it is unnecessary

* Translated ManagedBatchParser

* test culture value

* test culture change

* temporarily comment out service layer command options

* returned sr.cs

* temporarily remove bad tests

* restored tests and allowed for SR culture to change for dependencies (for future testing)

* localization for resourceprovider components added.

* Set LocaleSetter to public and also removed InternalsVisible for Kusto, Credentials and ResourceProvider

* removed unnecessary changes

* Removed CredentialsCommandOptions

* renamed pt-BR to pt-br

* Rename sr.pt-BR.xlf.template to sr.pt-br.xlf.template

* Rename src/Microsoft.SqlTools.ServiceLayer/Localization/LCL/pt-BR/sr.resx.lcl to src/Microsoft.SqlTools.ServiceLayer/Localization/LCL/pt-br/sr.resx.lcl

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* Rename sr.pt-BR.xlf to sr.pt-br.xlf

* Rename sr.pt-BR.resx to sr.pt-br.resx

* restored newlines

* Update sr.pt-br.xlf.template

Removed newline

* removed newline

* fixing newlines for consistency

* removed unnecessary newline
2021-06-10 15:50:53 -07:00

58 lines
1.9 KiB
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Kusto.ServiceLayer.Utility;
using NUnit.Framework;
namespace Microsoft.Kusto.ServiceLayer.UnitTests.ServiceHost
{
/// <summary>
/// ScriptFile test case
/// </summary>
public class SrTests
{
[Test]
public void SrStringsTestWithEnLocalization()
{
string locale = "en";
var args = new string[] { "--locale", locale };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.AreEqual(SR.Culture.Name, options.Locale);
Assert.AreEqual(options.Locale, locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.AreEqual("test", TestLocalizationConstant);
}
[Test]
public void SrStringsTestWithEsLocalization()
{
string locale = "es";
var args = new string[] { "--locale", locale };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.AreEqual(SR.Culture.Name, options.Locale);
Assert.AreEqual(options.Locale, locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.AreEqual("prueba", TestLocalizationConstant);
// Reset the locale
SrStringsTestWithEnLocalization();
}
[Test]
public void SrStringsTestWithNullLocalization()
{
SR.Culture = null;
var args = new string[] { "" };
ServiceLayerCommandOptions options = new ServiceLayerCommandOptions(args);
Assert.Null(SR.Culture);
Assert.AreEqual("", options.Locale);
var TestLocalizationConstant = SR.TestLocalizationConstant;
Assert.AreEqual("test", TestLocalizationConstant);
}
}
}