Skip to content

Commit

Permalink
verify OnRunCompleted waits for pipeline to complete
Browse files Browse the repository at this point in the history
  • Loading branch information
drewburlingame committed Nov 26, 2023
1 parent 6b4bb01 commit a64a72f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CommandDotNet.Tests/FeatureTests/OnRunCompletedTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -18,16 +19,24 @@ public void OnRunCompleted_IsCalled_AfterPipelineIsExecuted()
new AppRunner<App>()
.Configure(b => b.OnRunCompleted += args =>
{
// ensure OnRunCompleted waits for the pipeline to complete
App.Executed.Should().BeTrue();
wasCalled = true;
})
.RunInMem("");
.RunInMem("Do");

wasCalled.Should().BeTrue();
}

private class App
{
public void Do() { }
public static bool Executed { get; set; }

public void Do()
{
Task.Delay(1000);
Executed = true;
}
}
}
}

0 comments on commit a64a72f

Please sign in to comment.