public void GetImageBlocking()
        {
            var imageGetter = new FullSizeImageGetter();
            var result = imageGetter.BeginGetImage(null, _file.FullName);
            var actualImage = imageGetter.EndGetImage(result);

            AssertImagesAreEquivalent(_originalImage, actualImage);
            Assert.IsFalse(result.CompletedSynchronously);
        }
        public void GetImageRunCallback()
        {
            var imageGetter = new FullSizeImageGetter();
            var callbackCompleted = false;
            var done = new ManualResetEventSlim(false);
            var result = imageGetter.BeginGetImage(ar =>
                                    {
                                        Assert.IsNotNull(ar);
                                        Assert.IsTrue(ar.IsCompleted);
                                        var actualImage = imageGetter.EndGetImage(ar);

                                        AssertImagesAreEquivalent(_originalImage, actualImage);
                                        callbackCompleted = true;
                                        done.Set();
                                    }, _file.FullName);

            Assert.IsFalse(callbackCompleted);

            //result.AsyncWaitHandle.WaitOne(); //doesn't wait for callback complete, just callback init

            Assert.IsTrue(done.Wait(60000));
            Assert.IsFalse(result.CompletedSynchronously);
            Assert.IsTrue(callbackCompleted);
        }