Updating the global.json creation to use the IFile interface and adding a unit test to cover it.

This commit is contained in:
Livar Cunha 2017-05-22 09:51:30 -07:00
parent f67a72d9c4
commit 822b290bb6
2 changed files with 17 additions and 5 deletions

View file

@ -96,13 +96,13 @@ namespace Microsoft.DotNet.Configurer
</packageSources>
</configuration>");
File.WriteAllText(
_file.WriteAllText(
Path.Combine(workingDirectory, "global.json"),
$@"{{
""sdk"": {{
""version"":""{Product.Version}""
}}
}}");
""sdk"": {{
""version"":""{Product.Version}""
}}
}}");
succeeded &= CreateTemporaryProject(workingDirectory, templateInfo);

View file

@ -163,6 +163,18 @@ namespace Microsoft.DotNet.Configurer.UnitTests
</configuration>");
}
[Fact]
public void It_writes_a_global_json_file_with_the_current_cli_version()
{
var nugetConfigPath = Path.Combine(_temporaryDirectoryMock.DirectoryPath, "global.json");
_fileSystemMock.File.ReadAllText(nugetConfigPath).Should().Be(
$@"{{
""sdk"": {{
""version"":""{Product.Version}""
}}
}}");
}
[Fact]
public void It_uses_a_config_file_with_dotnet_restore()
{