##// END OF EJS Templates
Добавлена метка v3.0.6 для набора изменений 547a2fc0d93e
Добавлена метка v3.0.6 для набора изменений 547a2fc0d93e

File last commit:

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