Skip to content

Commit

Permalink
reviewed test WaitControl
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Cerqueira committed Jul 25, 2023
1 parent 8224531 commit 218daef
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions UnitTests/Controls/TaskWaitControl/WaitControlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,24 +342,41 @@ public void Should_EventAbortSequential()
[Fact]
public void Should_EventChangeConext()
{
var root = new object();
var ctrl = (WaitControl<int>)PromptPlus.WaitProcess<int>("P", "D")
.MaxDegreeProcess(2)
.Context(0)
.AddStep(StepMode.Parallel, (evt, cts) =>
{
evt.Context++;
//not thread-safed
lock (root)
{
evt.Context++;
}
})
.AddStep(StepMode.Parallel, (evt, cts) =>
{
evt.Context++;
//not thread-safed
lock (root)
{
evt.Context++;
}
})
.AddStep(StepMode.Parallel, (evt, cts) =>
{
evt.Context++;
//not thread-safed
lock (root)
{
evt.Context++;
}
})
.AddStep(StepMode.Parallel, (evt, cts) =>
{
evt.Context++;
//not thread-safed
lock (root)
{
evt.Context++;
}
});

ActionOnDispose = () => ctrl.FinalizeControl(CancellationToken.None);
Expand Down

0 comments on commit 218daef

Please sign in to comment.