public void InvokesOnFinishedOnceWhenOpenOrThrowDisposed()
        {
            object receivedInOnFinished = null;

            var passedToPlayer  = new object();
            var onFinishedCount = 0;

            var action = new Action <object>(
                o =>
            {
                receivedInOnFinished = o;
                onFinishedCount++;
            });
            var setup = new ResolveSetup <object>(new ResolveSetupArgs(
                                                      this._resolveOpen,
                                                      p =>
            {
                var disposable = p(this._uri, passedToPlayer);
                disposable.Dispose();
            }));

            setup.OnFinished(action).OpenOrThrow();

            Assert.AreEqual(1, onFinishedCount);
            Assert.AreEqual(passedToPlayer, receivedInOnFinished);
        }
        public void DoesntInvokeCallbackWhenSetupOnFinished()
        {
            var wasCalled = false;

            var setup = new ResolveSetup <string>(
                new ResolveSetupArgs(this._resolveOpen, _ => wasCalled = true));

            setup.OnFinished(s => { });

            Assert.IsFalse(wasCalled);
        }
        public void DoesntInvokeOnFinishedWhenOpenOrThrow()
        {
            var wasCalled = false;

            var action = new Action <object>(o => wasCalled = true);
            var setup  = new ResolveSetup <object>(
                new ResolveSetupArgs(this._resolveOpen, p => p(this._uri, new object())));

            setup.OnFinished(action).OpenOrThrow();

            Assert.IsFalse(wasCalled);
        }