##// END OF EJS Templates
minor fixes
minor fixes

File last commit:

r260:547a2fc0d93e v3.0.6 v3
r260:547a2fc0d93e v3.0.6 v3
Show More
RunnableComponentTests.cs
30 lines | 898 B | text/x-csharp | CSharpLexer
/ Implab.Test / RunnableComponentTests.cs
cin
PollingComponent: implemented correct stopping
r259 using System;
using System.Threading;
using System.Threading.Tasks;
using Implab.Components;
using Xunit;
cin
minor fixes
r260 namespace Implab.Test {
cin
PollingComponent: implemented correct stopping
r259
cin
minor fixes
r260 public class RunnableComponentTests {
cin
PollingComponent: implemented correct stopping
r259 [Fact]
cin
minor fixes
r260 public async Task Test1() {
cin
PollingComponent: implemented correct stopping
r259
cin
minor fixes
r260 using (var m = new MockPollComponent(true)) {
m.StartWorker = async (ct) => await Task.Yield();
m.StopWorker = async (ct) => await Task.Yield();
cin
PollingComponent: implemented correct stopping
r259
cin
minor fixes
r260 Assert.Equal(ExecutionState.Ready, m.State);
Assert.NotNull(m.Completion);
cin
PollingComponent: implemented correct stopping
r259
cin
minor fixes
r260 m.Start(CancellationToken.None);
await m.Completion;
Assert.Equal(ExecutionState.Running, m.State);
cin
PollingComponent: implemented correct stopping
r259
cin
minor fixes
r260 m.Stop(CancellationToken.None);
await m.Completion;
Assert.Equal(ExecutionState.Stopped, m.State);
cin
PollingComponent: implemented correct stopping
r259 }
}
}
}