예제 #1
0
        public virtual async Task InvokeAsync(IPipelineContext <DomainName> context, PipelineTaskDelegate <DomainName> nextMiddleware)
        {
            string log  = $"Ping {context.Resource.Value}...";
            bool   isOk = await _pingService.PingAsync(context.Resource.Value);

            log += isOk ? "Ok" : "Error";
            Log(log);
            context.Items[context.Resource.Value] = isOk;
            await nextMiddleware(context);
        }
예제 #2
0
        public PipelineTaskDelegate <TResource> Build()
        {
            PipelineTaskDelegate <TResource> lastDelegate = ctx => Task.CompletedTask;

            foreach (var task in _tasks.Reverse())
            {
                lastDelegate = task(lastDelegate);
            }
            return(lastDelegate);
        }
예제 #3
0
 public async Task InvokeAsync(IPipelineContext <DomainName> context, PipelineTaskDelegate <DomainName> nextMiddleware)
 {
     WriteColor($"Results run at [{DateTime.Now:HH:mm:ss.fff}]:\n", ConsoleColor.Cyan);
     if (context.Resource.Value == "github.com")
     {
         Console.Write("Github - ");
         WriteStatus((bool)context.Items["github.com"]);
         Console.Write("\n");
     }
     if (context.Resource.Value == "google.com")
     {
         Console.Write("Google - ");
         WriteStatus((bool)context.Items["google.com"]);
         Console.Write("\n");
     }
     await nextMiddleware(context);
 }