public void ShouldInvokeAsyncronously()
        {
            var startContext = SynchronizationContext.Current;
            var model = new ModelStub();

            PropertyChangedEventArgs args = null;
            model.PropertyChanged += (sender, e) => args = e;

            Action onComplete = () =>
                                    {
                                        model.ActionInvoked.ShouldBe(true);
                                        model.AsyncOperationCount.ShouldBe(0);
                                        model.AsyncCountDuringAction.ShouldBe(1);
                                        SynchronizationContext.Current.ShouldBe(startContext);
                                        args.PropertyName.ShouldBe(PropRunningAsyncOperations);

                                        EnqueueTestComplete();
                                    };

            model.DoAsync(startContext, 50, onComplete);
        }
        public void ShouldRunSynchronously()
        {
            var model = new ModelStub();
            ModelBase.IsAsyncEnabled.ShouldBe(true);
            ModelBase.IsAsyncEnabled = false;

            PropertyChangedEventArgs args = null;
            model.PropertyChanged += (sender, e) => args = e;

            var onCompleteCalled = false;
            Action onComplete = () =>
                                    {
                                        onCompleteCalled = true;
                                    };

            var result =model.DoAsync(5, onComplete);
            result.ShouldBe(null);

            onCompleteCalled.ShouldBe(true);
            model.ActionInvoked.ShouldBe(true);
            model.AsyncOperationCount.ShouldBe(0);
            model.AsyncCountDuringAction.ShouldBe(1);
            args.PropertyName.ShouldBe(PropRunningAsyncOperations);
        }