Exemplo n.º 1
0
        public void DoesntInvokeCallbackWhenSetupOnReady()
        {
            var wasCalled = false;

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

            setup.OnReady(s => { });

            Assert.IsFalse(wasCalled);
        }
Exemplo n.º 2
0
        public void LogsWhenResolvedIncompatibleOnOpenOrThrow()
        {
            var resolved = new List <int>();

            var setup = new ResolveSetup <StringBuilder>(new ResolveSetupArgs(
                                                             this._resolveOpen, p => p(this._uri, resolved)));

            var expectedTypeName = typeof(StringBuilder).Name;
            var resolvedTypeName = resolved.GetType().Name;

            setup.OnReady(_ => { }).OpenOrThrow();

            this._traceListener.Received(1).TraceEvent(
                Arg.Any <TraceEventCache>(),
                Arg.Any <string>(),
                TraceEventType.Warning,
                Arg.Any <int>(),
                Arg.Any <string>(),
                Arg.Is <object[]>(ps => ps.Contains(expectedTypeName) && ps.Contains(resolvedTypeName)));
        }
Exemplo n.º 3
0
        public void InvokesOnReadyOnceWhenOpen()
        {
            object receivedInOnReady = null;

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

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

            setup.OnReady(action).Open();

            Assert.AreEqual(1, onReadyCount);
            Assert.AreEqual(passedToPlayer, receivedInOnReady);
        }