public void Test___Method_Reset___Status_Stopped() { var to = new AnyVariable <int>() { Value = 0 }; var testee = new IfActivity() { Condition = new TrueCondition(), Then = new AssignActivity() { To = to, Value = new AnyVariable <int>() { Value = 1 } }, Else = new AssignActivity() { To = to, Value = new AnyVariable <int>() { Value = 2 } } }; testee.Stop(); Assert.AreEqual(ActivityStatus.Stopped, testee.Status); Assert.AreEqual(0, to.GetValueAsObject()); testee.Reset(); Assert.AreEqual(ActivityStatus.Created, testee.Status); }
public async Task Test___Method_Stop___Status_Suspended() { var testee = new IfActivity() { Condition = new TrueCondition(), Then = new SuspendActivity() { Until = new FalseCondition() } }; await testee.Start(); Assert.AreEqual(ActivityStatus.Suspended, testee.Status); testee.Stop(); Assert.AreEqual(ActivityStatus.Stopped, testee.Status); }
public async Task Test___Method_Stop___Status_Executing() { var testee = new IfActivity() { Condition = new TrueCondition(), Then = new DelayActivity() { Duration = new AnyVariable <int>() { Value = 1000 } } }; var task = testee.Start(); Assert.AreEqual(ActivityStatus.Executing, testee.Status); testee.Stop(); await task; Assert.AreEqual(ActivityStatus.Stopped, testee.Status); }