public void RunsTakeSagaWaitingForAction() { //Arrange var runner = new Saga(); var enumerator = runner.Run(this.RootSaga()); //Act SagaAction returnData = null; runner.OnActionEvent += (data) => { returnData = data; }; for (var i = 0; i < 100; i++) { enumerator.MoveNext(); } //Assert Assert.IsNull(returnData); runner.OnAction(new SagaAction <int>("start", 11)); for (var i = 0; i < 100; i++) { enumerator.MoveNext(); } //Assert Assert.AreEqual("test", returnData.Type); Assert.AreEqual(11, returnData.GetPayload <int>()); }
// Use this for initialization void Start() { var saga = new Saga(); saga.OnActionEvent += Saga_OnActionEvent; this.StartCoroutine(saga.Run(this.RootSaga())); }
protected void RunSaga(Saga runner, IEnumerator sagaToRun) { //Arrange var enumerator = runner.Run(sagaToRun); while (enumerator.MoveNext()) { ; } }
public void RunsSagaAndPutsSingleAction() { //Arrange var runner = new Saga(); var enumerator = runner.Run(this.RootSaga()); //Act object returnData = null; runner.OnActionEvent += (data) => { returnData = data; }; while (enumerator.MoveNext()) { ; } //Assert Assert.IsNotNull(returnData); }