mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
* 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
77 lines
3.1 KiB
C#
77 lines
3.1 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.SqlTools.Hosting.Utility;
|
|
using NUnit.Framework;
|
|
|
|
using CredSR = Microsoft.SqlTools.Credentials.SR;
|
|
|
|
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Credentials
|
|
{
|
|
/// <summary>
|
|
/// ScriptFile test case
|
|
/// </summary>
|
|
public class SrTests
|
|
{
|
|
const string CredentialsServiceName = "MicrosoftSqlToolsCredentials.exe";
|
|
/// <summary>
|
|
/// Simple "test" to access string resources
|
|
/// The purpose of this test is for code coverage. It's probably better to just
|
|
/// exclude string resources in the code coverage report than maintain this test.
|
|
/// </summary>
|
|
[Test]
|
|
public void SrStringsTest()
|
|
{
|
|
var culture = CredSR.Culture;
|
|
CredSR.Culture = culture;
|
|
Assert.True(CredSR.Culture == culture);
|
|
|
|
var CredentialsServiceInvalidCriticalHandle = CredSR.CredentialsServiceInvalidCriticalHandle;
|
|
var CredentialsServicePasswordLengthExceeded = CredSR.CredentialsServicePasswordLengthExceeded;
|
|
var CredentialsServiceTargetForDelete = CredSR.CredentialsServiceTargetForDelete;
|
|
var CredentialsServiceTargetForLookup = CredSR.CredentialsServiceTargetForLookup;
|
|
var CredentialServiceWin32CredentialDisposed = CredSR.CredentialServiceWin32CredentialDisposed;
|
|
}
|
|
|
|
[Test]
|
|
public void SrStringsTestWithEnLocalization()
|
|
{
|
|
string locale = "en";
|
|
var args = new string[] { "--locale", locale };
|
|
CommandOptions options = new CommandOptions(args, CredentialsServiceName);
|
|
Assert.AreEqual(options.Locale, locale);
|
|
|
|
var CredentialsServiceInvalidCriticalHandle = CredSR.CredentialsServiceInvalidCriticalHandle;
|
|
Assert.AreEqual("Invalid CriticalHandle!", CredentialsServiceInvalidCriticalHandle);
|
|
}
|
|
|
|
[Test]
|
|
public void SrStringsTestWithEsLocalization()
|
|
{
|
|
string locale = "es";
|
|
var args = new string[] { "--locale", locale };
|
|
CommandOptions options = new CommandOptions(args, CredentialsServiceName);
|
|
Assert.AreEqual(options.Locale, locale);
|
|
|
|
var CredentialsServiceInvalidCriticalHandle = CredSR.CredentialsServiceInvalidCriticalHandle;
|
|
Assert.AreEqual("CriticalHandle no válido!", CredentialsServiceInvalidCriticalHandle);
|
|
|
|
// Reset the locale
|
|
SrStringsTestWithEnLocalization();
|
|
}
|
|
|
|
[Test]
|
|
public void SrStringsTestWithNullLocalization()
|
|
{
|
|
CredSR.Culture = null;
|
|
var args = new string[] { "" };
|
|
CommandOptions options = new CommandOptions(args, CredentialsServiceName);
|
|
Assert.AreEqual("", options.Locale);
|
|
|
|
var CredentialsServiceInvalidCriticalHandle = CredSR.CredentialsServiceInvalidCriticalHandle;
|
|
Assert.AreEqual("Invalid CriticalHandle!", CredentialsServiceInvalidCriticalHandle);
|
|
}
|
|
}
|
|
}
|