mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-30 01:25:45 -05:00
Fix schema compare project test cleanup (#1746)
* cleanup .sqlproj in finally * unique folder per test run * fix path
This commit is contained in:
@@ -24,8 +24,13 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
{
|
||||
private static string sqlProjectsFolder = Path.Combine("..", "..", "..", "SchemaCompare", "SqlProjects");
|
||||
|
||||
internal static void VerifyAndCleanup(string path)
|
||||
internal static void VerifyAndCleanup(string? path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// verify it was created...
|
||||
Assert.True(File.Exists(path) || Directory.Exists(path), $"File or directory {path} was expected to exist but did not");
|
||||
|
||||
@@ -98,7 +103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.SchemaCompare
|
||||
/// <returns>Full path to the .sqlproj</returns>
|
||||
internal static string CreateSqlProj(string projectName)
|
||||
{
|
||||
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SchemaCompareTest", projectName);
|
||||
string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SchemaCompareTest", $"{TestContext.CurrentContext?.Test?.Name}_{projectName}_{DateTime.Now.Ticks.ToString()}");
|
||||
Directory.CreateDirectory(folderPath);
|
||||
string sqlprojFilePath = Path.Combine(folderPath, projectName + ".sqlproj");
|
||||
File.Copy(Path.Combine(sqlProjectsFolder, "emptyTemplate.sqlproj"), sqlprojFilePath);
|
||||
|
||||
Reference in New Issue
Block a user