Пример #1
0
        public void Should_be_called_during_the_final_execution_state()
        {
            string expected = "47";
            string called = null;

            Feather<string> logger = new LogFeather<string>(Console.Out, x =>
                {
                    called = x.Data;
                    return x.Data;
                });

            Feather<string> profiler = new ProfilerFeather<string>(Console.Error, TimeSpan.FromMilliseconds(2));

            Vane<string> vane = VaneFactory.Success(profiler, logger);

            vane.Execute(expected);

            Assert.IsFalse(string.IsNullOrEmpty(called));
            Assert.AreEqual(expected, called);
        }
Пример #2
0
        public void Setup()
        {
            var messageConsumerVane = new MessageConsumerFeather<A, WorkingConsumer>(x => x.Consume);
            Vane<Tuple<Message<A>, WorkingConsumer>> consumerVane = VaneFactory.Success(messageConsumerVane);

            var messageConsumerVaneB = new MessageConsumerFeather<B, WorkingConsumer>(x => x.Consume);
            Vane<Tuple<Message<B>, WorkingConsumer>> consumerVaneB = VaneFactory.Success(messageConsumerVaneB);

            var factoryVane = new FactorySourceVane<WorkingConsumer>(() => new WorkingConsumer());
            var loggerVane = new LogFeather<WorkingConsumer>(Console.Out, x => "Logging");
            var profilerVane = new ProfilerFeather<WorkingConsumer>(Console.Out, TimeSpan.FromMilliseconds(1));

            var sourceVane = VaneFactory.Source(factoryVane, loggerVane, profilerVane);
            var spliceVane = new SpliceFeather<Message<A>, WorkingConsumer>(consumerVane, sourceVane);

            var messageVane = new MessageTypeFeather<A>(VaneFactory.Success(spliceVane));

            var spliceVaneB = new SpliceFeather<Message<B>, WorkingConsumer>(consumerVaneB, sourceVane);
            var messageVaneB = new MessageTypeFeather<B>(VaneFactory.Success(spliceVaneB));

            var fanOutVane = new FanoutFeather<Message>(new Feather<Message>[] { messageVane, messageVaneB });

            _vane = VaneFactory.Success(fanOutVane);
        }