Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Central feed fixes for tests #478

Merged
merged 8 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/Microsoft.Build.Sql.Tests/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void VerifyBuildFailureWithUnresolvedReference()
public void VerifyBuildWithProjectReference()
{
// We will copy the ReferenceProj to a temp folder and then add it as project reference
string tempFolder = Path.Combine(Path.GetTempPath(), TestContext.CurrentContext.Test.Name);
string tempFolder = TestUtils.CreateTempDirectory();
TestUtils.CopyDirectoryRecursive(Path.Combine(this.CommonTestDataDirectory, "ReferenceProj"), tempFolder);

this.AddProjectReference(Path.Combine(tempFolder, "ReferenceProj.sqlproj"));
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected int RunDotnetCommandOnProject(string dotnetCommand, out string stdOutp
ProcessStartInfo dotnetStartInfo = new ProcessStartInfo
{
FileName = TestUtils.GetDotnetPath(),
Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments}",
Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments} -v n",
WorkingDirectory = this.WorkingDirectory,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
Expand Down
10 changes: 10 additions & 0 deletions test/Microsoft.Build.Sql.Tests/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ public static string EscapeTestName(string testName)
{
return testName.Replace("\"", "_");
}

/// <summary>
/// Creates and returns the path to a temporary directory in the current directory.
/// </summary>
public static string CreateTempDirectory()
{
string tempDir = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName());
Directory.CreateDirectory(tempDir);
return tempDir;
}
}
}