Exemplo n.º 1
0
        public void DefaultTest()
        {
            LocalTestingClass testObject = new LocalTestingClass();
            ICommand          cmd        = new RelayCommand(p1 => testObject.Test = p1.ToString(), p2 => true);

            cmd.Execute("defaulttest");

            Assert.AreEqual("defaulttest", testObject.Test);
        }
Exemplo n.º 2
0
        public void OverridePreActionTest()
        {
            LocalTestingClass testObject = new LocalTestingClass();

            RelayCommand cmd = new RelayCommand(p1 => testObject.Test += p1.ToString(), p2 => true);

            cmd.OverridePreActionDelegate(() => testObject.Test += "preOverriden");
            cmd.Execute("");

            Assert.AreEqual("preOverriden", testObject.Test);
        }
Exemplo n.º 3
0
        public void PostActionTest()
        {
            LocalTestingClass testObject = new LocalTestingClass();

            Action postAction = new Action(() => testObject.Test += "end");

            ICommand cmd = new RelayCommand(p1 => testObject.Test += p1.ToString(), p2 => true, null, postAction);

            cmd.Execute("pretest");

            Assert.AreEqual("pretestend", testObject.Test);
        }
Exemplo n.º 4
0
        public void PreActionTest()
        {
            LocalTestingClass testObject = new LocalTestingClass();

            Action preAction = new Action(() => testObject.Test = "start");

            ICommand cmd = new RelayCommand(p1 => testObject.Test += p1.ToString(), p2 => true, preAction, null);

            cmd.Execute("pretest");

            Assert.AreEqual("startpretest", testObject.Test);
        }