Skip to content

Commit c2efb7a

Browse files
committed
Fix test
1 parent 0fd6575 commit c2efb7a

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

tests/Aspire.Hosting.Tests/MSBuildTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,13 @@ await Verify(new
240240
App = appMetadata
241241
}).ScrubLinesWithReplace(line =>
242242
{
243-
var temp = tempDirectory?.Path;
243+
var temp = tempDirectory?.Directory?.Name;
244244
if (temp is not null)
245245
{
246-
line = line.Replace(temp, "{AspirePath}");
246+
if (line.Contains(temp))
247+
{
248+
line = line.Replace(temp, "{AspirePath}").Replace(Path.DirectorySeparatorChar, '/');
249+
}
247250
}
248251
return line;
249252
});

tests/Aspire.Hosting.Tests/Snapshots/MSBuildTests.ValidateMetadataSources.verified.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,43 @@
44

55
namespace Projects;
66

7+
#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language.
78
/// <summary>
89
/// Metadata for the Aspire Host project.
910
/// </summary>
1011
[global::System.CodeDom.Compiler.GeneratedCode("Aspire.Hosting", null)]
1112
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification = "Generated code.")]
1213
[global::System.Diagnostics.DebuggerDisplay("Type = {GetType().Name,nq}, ProjectPath = {ProjectPath}")]
1314
public class AppHost
15+
#pragma warning restore CS8981
1416
{
1517
private AppHost() { }
1618

1719
/// <summary>
1820
/// The path to the Aspire Host project.
1921
/// </summary>
20-
public static string ProjectPath => """{AspirePath}\AppHost""";
22+
public static string ProjectPath => """{TempPath}{AspirePath}/AppHost""";
2123
}
2224
,
2325
App:
2426
// <auto-generated/>
2527

2628
namespace Projects;
2729

30+
#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language.
2831
/// <summary>
2932
/// Metadata for the App project.
3033
/// </summary>
3134
[global::System.CodeDom.Compiler.GeneratedCode("Aspire.Hosting", null)]
3235
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification = "Generated code.")]
3336
[global::System.Diagnostics.DebuggerDisplay("Type = {GetType().Name,nq}, ProjectPath = {ProjectPath}")]
3437
public class App : global::Aspire.Hosting.IProjectMetadata
38+
#pragma warning restore CS8981
3539
{
3640
/// <summary>
3741
/// The path to the App project.
3842
/// </summary>
39-
public string ProjectPath => """{AspirePath}\App\App.csproj""";
43+
public string ProjectPath => """{TempPath}{AspirePath}/App/App.csproj""";
4044
}
4145

4246
}

tests/Shared/TempDirectory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
public sealed class TempDirectory : IDisposable
55
{
6-
public string Path { get; } = Directory.CreateTempSubdirectory(".aspire-tests").FullName;
6+
public string Path => Directory.FullName;
7+
8+
public DirectoryInfo Directory { get; } = System.IO.Directory.CreateTempSubdirectory(".aspire-tests");
79

810
public void Dispose()
911
{
1012
try
1113
{
12-
Directory.Delete(Path, recursive: true);
14+
System.IO.Directory.Delete(Path, recursive: true);
1315
}
1416
catch { } // Ignore errors during cleanup
1517
}

0 commit comments

Comments
 (0)