edit with skylar suggestion and add/edit summary of some methods · microsoft/VSConfigFinder@da912f2 (original) (raw)
`@@ -11,6 +11,8 @@ namespace VSConfigFinder.Test
`
11
11
``
12
12
`public class UtilitiesTests
`
13
13
`{
`
``
14
`+
const string VSConfig = ".vsconfig";
`
``
15
+
14
16
`[Fact]
`
15
17
`public void ValidateIsNotNullOrEmpty_NullOrEmpty_String_Throws_AppropriateException()
`
16
18
`{
`
`@@ -71,7 +73,7 @@ public void CreateOutput_Creates_FileOrArguments_With_Expected_String(bool creat
`
71
73
``
72
74
`if (createFile)
`
73
75
`{
`
74
``
`-
var outputPath = Path.Combine(options.ConfigOutputPath, ".vsconfig");
`
``
76
`+
var outputPath = Path.Combine(options.ConfigOutputPath, VSConfig);
`
75
77
`fileSystem.Verify(x => x.WriteAllText(outputPath, jsonString));
`
76
78
`}
`
77
79
`else
`
`@@ -102,6 +104,8 @@ public void ReadComponents_Reads_AllNestedDirectories_And_OutputsAllComponents()
`
102
104
``
103
105
`// pathA
`
104
106
`var pathA = "C:\pathA";
`
``
107
`+
var pathAConfigFile = Path.Combine(pathA, VSConfig);
`
``
108
+
105
109
`var pathAConfig = """
`
106
110
` {
`
107
111
` "Version": "1.0",
`
`@@ -114,7 +118,9 @@ public void ReadComponents_Reads_AllNestedDirectories_And_OutputsAllComponents()
`
114
118
`var pathAReader = new MemoryStream(Encoding.UTF8.GetBytes(pathAConfig));
`
115
119
``
116
120
`// pathB
`
117
``
`-
var pathB = "C:\pathA\pathB";
`
``
121
`+
var pathB = Path.Combine(pathA, "pathB");
`
``
122
`+
var pathBConfigFile = Path.Combine(pathB, VSConfig);
`
``
123
+
118
124
`var pathBConfig = """
`
119
125
` {
`
120
126
` "Version": "1.0",
`
`@@ -126,10 +132,10 @@ public void ReadComponents_Reads_AllNestedDirectories_And_OutputsAllComponents()
`
126
132
` """;
`
127
133
`var pathBReader = new MemoryStream(Encoding.UTF8.GetBytes(pathBConfig));
`
128
134
``
129
``
`-
fileSystem.Setup(x => x.GetFileSystemEntries("C:\pathA", "*.vsconfig", true)).Returns(new[] { pathA, pathB });
`
``
135
`+
fileSystem.Setup(x => x.GetFileSystemEntries("C:\pathA", "*"+VSConfig, true)).Returns(new[] { pathAConfigFile, pathBConfigFile });
`
130
136
``
131
``
`-
fileSystem.Setup(x => x.OpenFile(pathA)).Returns(pathAReader);
`
132
``
`-
fileSystem.Setup(x => x.OpenFile(pathB)).Returns(pathBReader);
`
``
137
`+
fileSystem.Setup(x => x.OpenFile(pathAConfigFile)).Returns(pathAReader);
`
``
138
`+
fileSystem.Setup(x => x.OpenFile(pathBConfigFile)).Returns(pathBReader);
`
133
139
``
134
140
`var components = Utilities.ReadComponents(fileSystem.Object, options);
`
135
141
`Assert.Equal(3, components.Length);
`