Add multi folderpath support, add --add to each output component, and… · microsoft/VSConfigFinder@7fddbd9 (original) (raw)
`@@ -7,7 +7,6 @@ namespace VSConfigFinder.Test
`
7
7
`{
`
8
8
`using Moq;
`
9
9
`using System.Text;
`
10
``
`-
using System.Text.Json;
`
11
10
`using Xunit;
`
12
11
``
13
12
`public class UtilitiesTests
`
`@@ -29,10 +28,14 @@ public void ValidateIsNotNullOrEmpty_NotNullOrEmpty_String_Succeeds()
`
29
28
`Utilities.ValidateIsNotNullOrEmpty(str, nameof(str));
`
30
29
`}
`
31
30
``
32
``
`-
[Fact]
`
33
``
`-
public void CreateOutput_Creates_File_With_Expected_String()
`
``
31
`+
[Theory]
`
``
32
`+
[InlineData(true)]
`
``
33
`+
[InlineData(false)]
`
``
34
`+
public void CreateOutput_Creates_FileOrArguments_With_Expected_String(bool createFile)
`
34
35
`{
`
35
36
`var fileSystem = new Mock();
`
``
37
`+
var logger = new Mock();
`
``
38
+
36
39
`var finalConfig = new VSConfig
`
37
40
`{
`
38
41
`Version = new Version("1.0"),
`
`@@ -59,25 +62,39 @@ public void CreateOutput_Creates_File_With_Expected_String()
`
59
62
``
60
63
`var options = new CommandLineOptions
`
61
64
`{
`
62
``
`-
FolderPath = "C:\input",
`
63
``
`-
CreateFile = true,
`
``
65
`+
FolderPath = new[] { "C:\input" },
`
``
66
`+
CreateFile = createFile,
`
64
67
`ConfigOutputPath = "C:\output",
`
65
68
`};
`
66
69
``
67
``
`-
Utilities.CreateOutput(fileSystem.Object, finalConfig, options);
`
``
70
`+
Utilities.CreateOutput(fileSystem.Object, logger.Object, finalConfig, options);
`
68
71
``
69
``
`-
var outputPath = Path.Combine(options.ConfigOutputPath, ".vsconfig");
`
70
``
`-
fileSystem.Verify(x => x.WriteAllText(outputPath, jsonString));
`
``
72
`+
if (createFile)
`
``
73
`+
{
`
``
74
`+
var outputPath = Path.Combine(options.ConfigOutputPath, ".vsconfig");
`
``
75
`+
fileSystem.Verify(x => x.WriteAllText(outputPath, jsonString));
`
``
76
`+
}
`
``
77
`+
else
`
``
78
`+
{
`
``
79
`+
var addArguments = "--add Microsoft.VisualStudio.Component.NuGet --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.Component.MSBuild --add Microsoft.NetCore.Component.Runtime.6.0";
`
``
80
`+
logger.Verify(x => x.Log(addArguments));
`
``
81
`+
}
`
71
82
`}
`
72
83
``
73
84
`[Fact]
`
74
85
`public void ReadComponents_Reads_AllNestedDirectories_And_OutputsAllComponents()
`
75
86
`{
`
``
87
`+
/*
`
``
88
`+
- folder structure:
`
``
89
`+
- pathA
`
``
90
`+
- pathB
`
``
91
`+
*/
`
``
92
+
76
93
`var fileSystem = new Mock();
`
77
94
``
78
95
`var options = new CommandLineOptions
`
79
96
`{
`
80
``
`-
FolderPath = "C:\input",
`
``
97
`+
FolderPath = new[] { "C:\input" },
`
81
98
`ConfigOutputPath = "C:\output",
`
82
99
`};
`
83
100
``