Exemple #1
0
        public void TestThatExceptionHandlerDelayRecovers()
        {
            var failureValue = -1;
            var completes    = new BasicCompletes <int>(new Scheduler());

            completes
            .AndThen(0, value => value * 2)
            .AndThen <int>(value => throw new Exception($"{value * 2}"));

            completes.With(10);

            completes.RecoverFrom(e => failureValue = int.Parse(e.Message));

            completes.Await <int>();

            Assert.True(completes.HasFailed);
            Assert.Equal(40, failureValue);
        }