Exemple #1
0
        public static async Task TestPipeApp()
        {
            var log = Setup.CreateTestLogger();
            var b   = new ContainerBuilder();

            b.RegisterType <PipeApp>();
            b.Register(_ => log).As <ILogger>();
            var scope   = b.Build();
            var store   = new AzureBlobFileStore("UseDevelopmentStorage=true", "pipe", log);
            var pipeCtx = new PipeCtx(new PipeAppCfg(), new PipeAppCtx(scope, typeof(PipeApp)), store, log);
            var res     = await pipeCtx.Run((PipeApp app) => app.MakeAndSum(200), new PipeRunOptions { Location = PipeRunLocation.Local });

            res.Metadata.Error.Should().BeFalse();
        }
Exemple #2
0
        public async ValueTask ExecuteAsync(IConsole console)
        {
            var channels = ChannelIds?.UnJoin('|').ToArray();

            // make a new app context with a custom region defined
            var appCtx = new PipeAppCtx(AppCtx)
            {
                CustomRegion = () => Rand.Choice(Regions)
            };

            // run the work using the pipe entry point, forced to be local
            PipeAppCfg.Location = PipeRunLocation.Local;
            var pipeCtx = new PipeCtx(PipeAppCfg, appCtx, PipeCtx.Store, PipeCtx.Log);
            await pipeCtx.Run((YtCollector d) => d.Collect(PipeArg.Inject <ILogger>(), ForceUpdate, false, channels, PipeArg.Inject <CancellationToken>()));
        }