Localization for tools work so far (#8251)

This commit is contained in:
William Lee 2018-01-13 09:40:48 -08:00 committed by GitHub
parent 2cfc65a0c4
commit e8f7ddd01b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 2848 additions and 83 deletions

View file

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using FluentAssertions;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.DependencyModel.Tests;
using Xunit;
@ -33,12 +34,9 @@ namespace Microsoft.DotNet.ShellShim.Tests
// similar to https://code.visualstudio.com/docs/setup/mac
fakeReporter.Message.Should().Be(
$"Cannot find the tools executable path. Please ensure /myhome/executable/path is added to your PATH.{Environment.NewLine}" +
$"If you are using bash. You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
$"cat << EOF >> ~/.bash_profile{Environment.NewLine}" +
$"# Add .NET Core SDK tools{Environment.NewLine}" +
$"export PATH=\"$PATH:/myhome/executable/path\"{Environment.NewLine}" +
$"EOF");
string.Format(
CommonLocalizableStrings.EnvironmentPathLinuxManualInstruction,
"/myhome/executable/path", "/myhome/executable/path"));
}
[Fact]
@ -78,8 +76,7 @@ namespace Microsoft.DotNet.ShellShim.Tests
linuxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();
fakeReporter.Message.Should()
.Be(
"Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.");
.Be(CommonLocalizableStrings.EnvironmentPathLinuxNeedLogout);
}
}
}

View file

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using FluentAssertions;
using Microsoft.DotNet.Configurer;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.DependencyModel.Tests;
using Xunit;
@ -33,12 +34,9 @@ namespace Microsoft.DotNet.ShellShim.Tests
// similar to https://code.visualstudio.com/docs/setup/mac
fakeReporter.Message.Should().Be(
$"Cannot find the tools executable path. Please ensure /myhome/executable/path is added to your PATH.{Environment.NewLine}" +
$"If you are using bash, You can do this by running the following command:{Environment.NewLine}{Environment.NewLine}" +
$"cat << EOF >> ~/.bash_profile{Environment.NewLine}" +
$"# Add .NET Core SDK tools{Environment.NewLine}" +
$"export PATH=\"$PATH:/myhome/executable/path\"{Environment.NewLine}" +
$"EOF");
string.Format(
CommonLocalizableStrings.EnvironmentPathOSXManualInstruction,
"/myhome/executable/path", "/myhome/executable/path"));
}
[Theory]
@ -79,8 +77,7 @@ namespace Microsoft.DotNet.ShellShim.Tests
osxEnvironmentPath.PrintAddPathInstructionIfPathDoesNotExist();
fakeReporter.Message.Should().Be(
"Since you just installed the .NET Core SDK, you will need to reopen terminal before running the tool you installed.");
fakeReporter.Message.Should().Be(CommonLocalizableStrings.EnvironmentPathOSXNeedReopen);
}
}
}

View file

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using FluentAssertions;
using Microsoft.DotNet.Tools;
using NuGet.Protocol.Core.Types;
using Xunit;
@ -28,7 +29,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
Action a = () => ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMalformed.xml");
a.ShouldThrow<ToolConfigurationException>()
.And.Message.Should()
.Contain("The tool's settings file is invalid xml");
.Contain(string.Format(CommonLocalizableStrings.ToolSettingsInvalidXml, string.Empty));
}
[Fact]
@ -37,7 +38,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
Action a = () => ToolConfigurationDeserializer.Deserialize("DotnetToolSettingsMissing.xml");
a.ShouldThrow<ToolConfigurationException>()
.And.Message.Should()
.Contain("The tool's settings file contains error");
.Contain(string.Format(CommonLocalizableStrings.ToolSettingsContainError, string.Empty));
}
[Fact]
@ -46,7 +47,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
Action a = () => new ToolConfiguration("na\0me", "my.dll");
a.ShouldThrow<ArgumentException>()
.And.Message.Should()
.Contain("Contains one or more invalid characters");
.Contain(string.Format(CommonLocalizableStrings.ContainInvalidCharacters, string.Empty));
}
}
}

View file

@ -39,6 +39,7 @@ SDK commands:
msbuild Runs Microsoft Build Engine (MSBuild).
vstest Runs Microsoft Test Execution Command Line Tool.
store Stores the specified assemblies in the runtime store.
install Add item to development environment.
help Show help.
Common options: