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); }
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); }
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); }
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); }