public void GetPropertyInfoTests() { var info = _testStubs.GetType().GetProperty("CanExecuteFlag"); PropertyInfo testInfo = _testStubs.GetPropertyInfo("CanExecuteFlag"); Assert.Equal(info, testInfo); }
public void GetPropertyInfoTests() { var info = _testStubs.GetType().GetProperty("CanExecuteFlag"); PropertyInfo testInfo = _testStubs.GetPropertyInfo("CanExecuteFlag"); Assert.AreEqual(info, testInfo, "GetPropertyInfo - Test failed to get a proper info."); }
public void CommandHandlerProxyCanExecuteChangedBoolProperty() { PropertyInfo boolPropertyInfo = _testStubs.GetPropertyInfo("CanExecuteFlag"); var chp = new WeakCommandHandlerProxy(_testStubs.ExecuteButton_Click_External, boolPropertyInfo, _testStubs); chp.CanExecuteChanged += CanExecuteChangedTest; bool result = chp.CanExecute(null); Assert.AreEqual(result, false, "Target delegate for ICommand:CanExecute() return wrong flag"); _testStubs.CanExecuteFlag = true; chp.Execute(null); result = chp.CanExecute(null); Assert.AreEqual(_testStubs.ExecuteButtonClickExternalCalled, true, "Target delegate for ICommand:Execute() was not called"); Assert.AreEqual(_testStubs.CanExecuteButtonClickExternalFlag, true, "Target delegate for ICommand:Execute() was not called"); Assert.AreEqual(result, true, "Target delegate for ICommand:CanExecute() return wrong flag"); Assert.AreEqual(_canExecuteCnagedCalled, true, "ICommand:CanExecuteChanged event was not risen"); }
public void CommandHandlerProxyCanExecuteChangedBoolProperty() { PropertyInfo boolPropertyInfo = _testStubs.GetPropertyInfo("CanExecuteFlag"); var chp = new WeakCommandHandlerProxy(_testStubs.ExecuteButton_Click_External, boolPropertyInfo, _testStubs); chp.CanExecuteChanged += CanExecuteChangedTest; bool result = chp.CanExecute(null); Assert.Equal(result, false); _testStubs.CanExecuteFlag = true; chp.Execute(null); result = chp.CanExecute(null); Assert.Equal(_testStubs.ExecuteButtonClickExternalCalled, true); Assert.Equal(_testStubs.CanExecuteButtonClickExternalFlag, true); Assert.Equal(result, true); Assert.Equal(_canExecuteCnagedCalled, true); }