Commit Graph

14 Commits

Author SHA1 Message Date
Antony Male b3064171c1 Fix up the failing unit tests 2019-09-22 17:12:54 +01:00
Antony Male fdfaefa94e Implement another mechanism of backup ActionTarget, using IRootObjectProvider 2015-10-06 12:57:08 +01:00
Antony Male 447f68f1f0 Only throw on click if action not found
It turns out there was a lovely little race with View.ActionTarget, where
either the View.ActionTarget or the corresponding {s:Action} could be
evaluated first. This meant setting View.ActionTarget was risky.

It happened to work in previous releases because the bootstrapper accessed
View.ViewManager, which caused its class ctor to run and somehow caused
View.ActionTarget to be evaluated earlier.

I don't think there's a decent way of getting around this: we can't
guarentee the order in which things in Xaml are going to be evaluated.
That's not the WPF way.

Therefore, only throw exceptions if someone actually clicks the button.
2015-10-03 15:50:55 +01:00
Antony Male fc7f164c53 Remove unnecessary usings in unit tests 2015-09-23 21:46:36 +01:00
Antony Male b98226b29f Use a DependencyProperty in CommandAction/EventAction to watch ActionTarget for changes
Seems to work much better. Could probably remove quite a bit of code though
a sensible base class
2015-02-24 12:38:53 +00:00
Antony Male cc4de1c852 CommandAction and EventAction no longer retain the View forever
Still needs a level of unit testing for PropertyChangeNotifier
2015-02-22 18:47:33 +00:00
Antony Male 3785fbf2af Add test to ensure guard method is propagated 2015-01-18 22:05:59 +00:00
Antony Male b3601e6f81 Actions throw on execute of ActionTarget hasn't changed from the default 2015-01-18 22:02:06 +00:00
Antony Male 68a60b0aee CommandAction unwraps TargetInvocationException, preserving stack trace 2015-01-14 08:30:08 +00:00
Antony Male 3f2d298ba2 Add more descriptive exceptions to Action error cases 2015-01-05 12:28:26 +00:00
Antony Male f36de34bb2 Execute.Dispatcher can never be null, and dispatches synchronously by default
The previous behaviour was to raise an exception unless Execute.Dispatcher
had been explicitly defined. This was to detect cases where the user hadn't
set up Execute correctly, and treat them as errors rather than simply going
ahead with some possibly-unexpected behaviour.

However, since BootstrapperBase sets Execute.Dispatcher automatically, it's
highly unlikely that itwould ever not be set when it needed to be. Exceptions
are design mode and unit tests, both of which want (or can cope with) a
synchronous dispatcher.

Hence the behaviour change. Execute.Dispatcher is a synchronous dispatcher
by default, but is overridden to one that uses Application.Current.Dispatcher
by the bootstrapper if we're in a real application.
2015-01-04 21:30:34 +00:00
Antony Male 9ee23f1469 Remove Execute.TestExecuteSynchronously, in favour of a synchronous IDispatcher implementation 2015-01-04 13:10:37 +00:00
Antony Male 4ed753e89e Bring unit test code coverage back to par 2014-07-25 13:11:51 +01:00
Antony Male a96ec2a6e4 Add tests for CommandAction and EventAction 2014-05-09 13:59:38 +01:00