Addressing code review comments.

This commit is contained in:
Livar Cunha 2016-11-01 00:49:03 -07:00
parent 9139c4006b
commit a95ddb4074

View file

@ -72,7 +72,7 @@ namespace Microsoft.DotNet.TestFramework
public TestAssetInstance WithNuGetConfig(string nugetCache) public TestAssetInstance WithNuGetConfig(string nugetCache)
{ {
var thisAssembly = typeof(TestAssetInstance).GetTypeInfo().Assembly; var thisAssembly = typeof(TestAssetInstance).GetTypeInfo().Assembly;
var newNuGetConfigPath = Path.Combine(Root.FullName, "NuGet.config"); var newNuGetConfig = Root.GetFile("Nuget.config");
using (var resource = thisAssembly.GetManifestResourceStream("NuGet.template.config")) using (var resource = thisAssembly.GetManifestResourceStream("NuGet.template.config"))
{ {
@ -80,10 +80,11 @@ namespace Microsoft.DotNet.TestFramework
var content = streamReader.ReadToEnd(); var content = streamReader.ReadToEnd();
content = content.Replace("$fullpath$", nugetCache); content = content.Replace("$fullpath$", nugetCache);
using (var newNuGetConfig = new FileStream(newNuGetConfigPath, FileMode.Create, FileAccess.Write)) using (var newNuGetConfigStream =
new FileStream(newNuGetConfig.FullName, FileMode.Create, FileAccess.Write))
{ {
var contentBytes = new UTF8Encoding(true).GetBytes(content); var contentBytes = new UTF8Encoding(true).GetBytes(content);
newNuGetConfig.Write(contentBytes, 0, contentBytes.Length); newNuGetConfigStream.Write(contentBytes, 0, contentBytes.Length);
} }
} }