Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartheek Penagamuri committed Dec 14, 2022
1 parent 0cf454f commit 170c754
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions test/NuGet.Core.Tests/NuGet.Common.Test/MigrationRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,21 @@ public void Run_WhenAThreadAbandonsMutexThenNextMigrationRunReleasesMutexAndCrea
Thread t = new Thread(new ThreadStart(AbandonMutex));
t.Start();
t.Join();
Assert.True(signal, userMessage: "Failed to acquire the mutex.");

string directory = MigrationRunner.GetMigrationsDirectory();
if (Directory.Exists(directory))
Directory.Delete(path: directory, recursive: true);

if (signal)
{
string directory = MigrationRunner.GetMigrationsDirectory();
if (Directory.Exists(directory))
Directory.Delete(path: directory, recursive: true);

// Act
MigrationRunner.Run();
// Act
MigrationRunner.Run();

// Assert
Assert.True(Directory.Exists(directory));
var files = Directory.GetFiles(directory);
Assert.Equal(1, files.Length);
Assert.Equal(Path.Combine(directory, "1"), files[0]);
}
// Assert
Assert.True(Directory.Exists(directory));
var files = Directory.GetFiles(directory);
Assert.Equal(1, files.Length);
Assert.Equal(Path.Combine(directory, "1"), files[0]);


void AbandonMutex()
{
Expand Down

0 comments on commit 170c754

Please sign in to comment.