public void TestMergeFailRatioFails() { var runner = new Merge("", 1, 1); runner.SucceedFailPercentForSucceess = 40; //under 40% succeed should fail runner.AddChild(TestingResources.GetRunRunSuccess()); //success = 1/1 runner.AddChild(TestingResources.GetRunRunFail()); //success = 1/2 runner.AddChild(TestingResources.GetRunRunFail()); //publish fail, success = 1/3 var actual = new List <BehaviorState>(); var expected = new List <BehaviorState>(); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Fail); runner.Start().Subscribe((x) => actual.Add(x)); Assert.AreEqual(expected, actual); }
public void TestMergeSucceedRatioSucceeds() { var runner = new Merge("", 1, 1); runner.SucceedFailPercentForSucceess = 51; //over 50% succeed should succeed runner.AddChild(TestingResources.GetRunRunSuccess()); //publish running, success = 1/1 runner.AddChild(TestingResources.GetRunRunSuccess()); //publish running, success = 2/2 runner.AddChild(TestingResources.GetRunRunFail()); //publish running, success = 2/3 //publish success, success = 2/3 var actual = new List <BehaviorState>(); var expected = new List <BehaviorState>(); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Running); expected.Add(BehaviorState.Success); runner.Start().Subscribe((x) => actual.Add(x)); Assert.AreEqual(expected, actual); }