コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }