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_object()
        {
            var dynamicEvent = new RedirectToDynamicEvent();
            var testClass = new TestClassWithMethod();
            dynamicEvent.WireToWhen(testClass);
            var t = new TestRedirectMethod { Id = 333, Name = "Name" };
            dynamicEvent.InvokeEvent(t);

            Assert.AreEqual(t, testClass.RedirectMethod);
        }
        public void when_wire_to_action()
        {
            var dynamicEvent = new RedirectToDynamicEvent();
            var testClass = new TestClassWithMethod();
            dynamicEvent.WireTo<int>(i => { testClass.Summa += i; });
            dynamicEvent.InvokeEvent(4);
            dynamicEvent.InvokeEvent(4);

            Assert.AreEqual(8, testClass.Summa);
        }
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_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_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);
        }
        public void when_wire_to_action()
        {
            var dynamicEvent = new RedirectToDynamicEvent();
            var testClass    = new TestClassWithMethod();

            dynamicEvent.WireTo <int>(i => { testClass.Summa += i; });
            dynamicEvent.InvokeEvent(4);
            dynamicEvent.InvokeEvent(4);

            Assert.AreEqual(8, testClass.Summa);
        }
Esempio n. 8
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_many_invoke()
        {
            var command = new RedirectToCommand();
            var testClass = new TestClassWithMethod();
            command.WireToMethod(testClass, "Method2");
            command.InvokeMany(new List<string> { "value1", "value2", "value3" });

            Assert.AreEqual(3, testClass.List.Count);
            Assert.AreEqual("value1", testClass.List[0]);
            Assert.AreEqual("value2", testClass.List[1]);
            Assert.AreEqual("value3", testClass.List[2]);
        }
        public void when_wire_to_object()
        {
            var dynamicEvent = new RedirectToDynamicEvent();
            var testClass    = new TestClassWithMethod();

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

            dynamicEvent.InvokeEvent(t);

            Assert.AreEqual(t, testClass.RedirectMethod);
        }
Esempio n. 11
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. 12
0
        public void when_many_invoke()
        {
            var command   = new RedirectToCommand();
            var testClass = new TestClassWithMethod();

            command.WireToMethod(testClass, "Method2");
            command.InvokeMany(new List <string> {
                "value1", "value2", "value3"
            });

            Assert.AreEqual(3, testClass.List.Count);
            Assert.AreEqual("value1", testClass.List[0]);
            Assert.AreEqual("value2", testClass.List[1]);
            Assert.AreEqual("value3", testClass.List[2]);
        }