예제 #1
0
        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>());
        }