Example #1
0
        public async Task <TRes> Process(TMessage1 message, IBackbone <TRes, TProgress> backbone, IProgress <TProgress> progress, CancellationToken cancelationToken)
        {
            cancelationToken.ThrowIfCancellationRequested();
            var message2 = await _Transformer.Transform(message, progress, cancelationToken);

            cancelationToken.ThrowIfCancellationRequested();
            return(await backbone.Process(message2, progress, cancelationToken));
        }
Example #2
0
            public async Task <bool> Process(string message, IBackbone <bool, int> backbone, IProgress <int> progress, CancellationToken cancelationToken)
            {
                if (!int.TryParse(message, out var res))
                {
                    return(false);
                }

                return(await backbone.Process(res, progress, cancelationToken));
            }
Example #3
0
        public void Process_WithMessageOfUnknowType_ThrowException()
        {
            Func <Task> act = () => _BackBone.Process(new object(), _Progess, CancellationToken.None);

            act.Should().Throw <ArgumentException>();
        }
Example #4
0
        public async Task Sample_Process_Int()
        {
            var res = await _BackBone.Process(20, null, CancellationToken.None);

            res.Should().BeTrue();
        }