Skip to content

Commit af30ca1

Browse files
author
Zubin Ramlakhan
committed
Reset TextReplacement.FileSystem in tests also.
Throw custom exception to investigate projguid method parameters on build server.
1 parent 529a4db commit af30ca1

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

CodeConverter/Shared/SolutionFileTextEditor.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ private static (string oldProjTypeReference, string newProjTypeReference) GetPro
8484
private static (string Find, string Replace, bool FirstOnly) GetProjectGuidReplacement(string projPath,
8585
string contents)
8686
{
87-
var projGuidRegex = new Regex(projPath + @""", ""({[0-9A-Fa-f\-]{32,36}})("")");
87+
var guidPattern = projPath + @""", ""({[0-9A-Fa-f\-]{32,36}})("")";
88+
var projGuidRegex = new Regex(guidPattern);
8889
var projGuidMatch = projGuidRegex.Match(contents);
90+
91+
if (!projGuidMatch.Success) {
92+
throw new OperationCanceledException($"{nameof(guidPattern)} {guidPattern} doesn't match with sourceSlnFileContents {contents}");
93+
}
94+
8995
var oldGuid = projGuidMatch.Groups[1].Value;
9096
var newGuid = GetDeterministicGuidFrom(new Guid(oldGuid));
9197
return (oldGuid, newGuid.ToString("B").ToUpperInvariant(), false);

Tests/CSharp/MultiFileSolutionAndProjectTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ public MultiFileSolutionAndProjectTests(MultiFileTestFixture multiFileTestFixtur
1717
_multiFileTestFixture = multiFileTestFixture;
1818
}
1919

20-
//[Fact] /* enable for executing locally */
21-
[Fact(Skip = "Doesn't work on Github actions agent")] /* disable for executing locally */
20+
[Fact] /* enable for executing locally */
2221
public async Task ConvertWholeSolutionAsync()
2322
{
2423

2524
await _multiFileTestFixture.ConvertProjectsWhereAsync(p => true, Language.CS);
2625
}
2726

28-
//[Fact] /* enable for executing locally */
29-
[Fact(Skip = "Doesn't work on Github actions agent")] /* disable for executing locally */
27+
[Fact] /* enable for executing locally */
3028
public async Task ConvertVbLibraryOnlyAsync()
3129
{
3230
await _multiFileTestFixture.ConvertProjectsWhereAsync(p => p.Name == "VbLibrary", Language.CS);

Tests/LanguageAgnostic/SolutionFileTextEditorTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public void Dispose()
3232
_sln = null;
3333
_fsMock.Reset();
3434
SolutionConverter.FileSystem = new FileSystem();
35+
TextReplacementConverter.FileSystem = new FileSystem();
3536
}
3637

3738
[Fact]

Tests/VB/MultiFileSolutionAndProjectTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ public MultiFileSolutionAndProjectTests(MultiFileTestFixture multiFileTestFixtur
1717
_multiFileTestFixture = multiFileTestFixture;
1818
}
1919

20-
//[Fact] /* enable for executing locally */
21-
[Fact(Skip = "Doesn't work on Github actions agent")] /* disable for executing locally */
20+
[Fact] /* enable for executing locally */
2221
public async Task ConvertWholeSolutionAsync()
2322
{
2423
await _multiFileTestFixture.ConvertProjectsWhereAsync(p => true, Language.VB);
2524
}
2625

27-
//[Fact] /* enable for executing locally */
28-
[Fact(Skip = "Doesn't work on Github actions agent")] /* disable for executing locally */
26+
[Fact] /* enable for executing locally */
2927
public async Task ConvertCSharpConsoleAppOnlyAsync()
3028
{
3129
await _multiFileTestFixture.ConvertProjectsWhereAsync(p => p.Name == "CSharpConsoleApp", Language.VB);

0 commit comments

Comments
 (0)