Beispiel #1
0
        public static void OnAwaitedEff_Position_ShouldReturnEffAwaiter()
        {
            var stateMachine = Test().GetStateMachine();

            stateMachine.MoveNext();

            Assert.Equal(StateMachinePosition.EffAwaiter, stateMachine.Position);
            Assert.Null(stateMachine.Exception);
            Assert.IsAssignableFrom <EffStateMachine <int> >(stateMachine.EffAwaiter);
            Assert.Null(stateMachine.TaskAwaiter);
            Assert.False(stateMachine.IsCompleted);

            async Eff <int> Test()
            {
                return(await Eff.FromResult(42));
            }
        }
Beispiel #2
0
        public async Task FromResult_ShouldReturnResult()
        {
            var eff = Eff.FromResult(42);

            Assert.Equal(42, await eff.Run(Handler));
        }