public async Task Test___Method_Stop___Status_Executing() { var testee = new FuncAsyncActivity() { Func = async(cancellationToken) => { await Task.Delay(1000, cancellationToken); if (cancellationToken.IsCancellationRequested) { return(false); } return(true); } }; var task = testee.Start(); Assert.AreEqual(ActivityStatus.Executing, testee.Status); testee.Stop(); //Assert.AreEqual(ActivityStatus.Stopping, testee.Status); await task; Assert.AreEqual(ActivityStatus.Stopped, testee.Status); }
public void Test___Method_Stop___Status_Created() { var testee = new FuncAsyncActivity() { Func = async(cancellationToken) => { await Task.Delay(100); return(true); } }; testee.Stop(); Assert.AreEqual(ActivityStatus.Stopped, testee.Status); }