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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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);
        }
Beispiel #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;
 }
Beispiel #11
0
        static void CallHandlers(RedirectToCommand serviceCommands, ImmutableEnvelope aem)
        {
            var content = aem.Items[0].Content;

            serviceCommands.Invoke(content);
        }
 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;
 }