Example #1
0
        static async Task Main()
        {
            var resolver = new DictionaryPipelineComponentResolver();

            resolver.AddAsync(new FooComponent(), new DelayComponent(), new BarComponent());
            resolver.Add(new FooComponentNonAsync(), new DelayComponentNonAsync(), new BarComponentNonAsync());

            var settings = new Dictionary <string, IDictionary <string, string> >
            {
                { nameof(DelayComponent), new Dictionary <string, string>
                  {
                      { "DelayTimeSpan", "00:00:05" }
                  } }
            };

            Console.WriteLine();

            // ReSharper disable once MethodHasAsyncOverload
            InvokePipeline(resolver, settings);

            await InvokePipelineAsync(resolver, settings);

            await InvokePipelineWithDependencyInjectionAndStatusReceiverAsync(settings);

            await InvokeNamedPipelinesWithDependencyInjectionAndStatusReceiverAsync();

            Console.Write("\nPress any key to exit...");
            Console.Read();
        }
Example #2
0
        public void Add_DuplicateComponent_Test()
        {
            //Arrange

            //Act
            Action act = () => _sut.Add(new FooComponent(), new FooComponent());

            //Assert
            act.Should().ThrowExactly <InvalidOperationException>();
        }