public void when_wire_to_lamda()
        {
            var command = new RedirectToCommand();
            var testClass = new TestClassWithMethod();
            command.WireToLambda<int>(i => { testClass.Summa += i; });
            command.Invoke(4);
            command.Invoke(4);

            Assert.AreEqual(8, testClass.Summa);
        }
Esempio n. 2
0
        public void when_wire_to_lamda()
        {
            var command   = new RedirectToCommand();
            var testClass = new TestClassWithMethod();

            command.WireToLambda <int>(i => { testClass.Summa += i; });
            command.Invoke(4);
            command.Invoke(4);

            Assert.AreEqual(8, testClass.Summa);
        }
        public void when_wire_to_method()
        {
            var command = new RedirectToCommand();
            var testClass = new TestClassWithMethod();
            command.WireToMethod(testClass, "Method1");
            command.Invoke("value1");

            Assert.IsTrue(testClass.CallMethod1);
        }
Esempio n. 4
0
        public void when_wire_to_method()
        {
            var command   = new RedirectToCommand();
            var testClass = new TestClassWithMethod();

            command.WireToMethod(testClass, "Method1");
            command.Invoke("value1");

            Assert.IsTrue(testClass.CallMethod1);
        }
        public void when_wire_to_when_method()
        {
            var command = new RedirectToCommand();
            var testClass = new TestClassWithMethod();
            command.WireToWhen(testClass);
            var t = new TestRedirectMethod { Id = 333, Name = "Name" };
            command.Invoke(t);

            Assert.AreEqual(t, testClass.RedirectMethod);
        }
Esempio n. 6
0
        public void when_wire_to_when_method()
        {
            var command   = new RedirectToCommand();
            var testClass = new TestClassWithMethod();

            command.WireToWhen(testClass);
            var t = new TestRedirectMethod {
                Id = 333, Name = "Name"
            };

            command.Invoke(t);

            Assert.AreEqual(t, testClass.RedirectMethod);
        }
Esempio n. 7
0
        static void CallHandlers(RedirectToCommand serviceCommands, ImmutableEnvelope aem)
        {
            var content = aem.Message;
            var watch   = Stopwatch.StartNew();

            serviceCommands.Invoke(content);
            watch.Stop();

            var seconds = watch.Elapsed.TotalSeconds;

            if (seconds > 10)
            {
                SystemObserver.Notify("[Warn]: {0} took {1:0.0} seconds", content.GetType().Name, seconds);
            }
        }
Esempio n. 8
0
        CqrsEngineBuilder BootstrapHandlers(Setup setup)
        {
            var builder = new CqrsEngineBuilder(_streamer);
            var handler = new RedirectToCommand();

            handler.WireToLambda <FailingMessage>(am => SmartFailing(am, setup.Store));
            builder.Handle(setup.Inbox, envelope =>
            {
                foreach (var message in envelope.Items)
                {
                    handler.Invoke(message.Content);
                }
            });
            return(builder);
        }
Esempio n. 9
0
        CqrsEngineBuilder BootstrapHandlers(Setup setup)
        {
            var builder = new CqrsEngineBuilder(_streamer);
            var writer  = setup.Store.Container.GetWriter <unit, int>();
            var handler = new RedirectToCommand();

            handler.WireToLambda <AtomicMessage>(am => HandleAtomic(am, setup.Sender, writer));
            handler.WireToLambda <NuclearMessage>(am => HandleNuclear(am, setup.Sender, setup.Store));
            builder.Handle(setup.Inbox, envelope =>
            {
                foreach (var message in envelope.Items)
                {
                    handler.Invoke(message.Content);
                }
            });
            return(builder);
        }
 CqrsEngineBuilder BootstrapHandlers(Setup setup)
 {
     var builder = new CqrsEngineBuilder(_streamer);
     var handler = new RedirectToCommand();
     handler.WireToLambda<FailingMessage>(am => SmartFailing(am, setup.Store));
     builder.Handle(setup.Inbox, envelope =>
         {
             foreach (var message in envelope.Items)
             {
                 handler.Invoke(message.Content);
             }
         });
     return builder;
 }
Esempio n. 11
0
        static void CallHandlers(RedirectToCommand serviceCommands, ImmutableEnvelope aem)
        {
            var content = aem.Items[0].Content;

            serviceCommands.Invoke(content);
        }
Esempio n. 12
0
 CqrsEngineBuilder BootstrapHandlers(Setup setup)
 {
     var builder = new CqrsEngineBuilder(_streamer);
     var writer = setup.Store.Container.GetWriter<unit, int>();
     var handler = new RedirectToCommand();
     handler.WireToLambda<AtomicMessage>(am => HandleAtomic(am, setup.Sender, writer));
     handler.WireToLambda<NuclearMessage>(am => HandleNuclear(am, setup.Sender, setup.Store));
     builder.Handle(setup.Inbox, envelope =>
     {
         foreach (var message in envelope.Items)
         {
             handler.Invoke(message.Content);
         }
     });
     return builder;
 }