Exemplo n.º 1
0
        public void BeforeCallPassTokenIntoChannel()
        {
            using (var sourceInput = new CancellationTokenSource())
                using (var sourceOutput = new CancellationTokenSource())
                {
                    var inputToken  = new CancellationTokenProxy(sourceInput.Token);
                    var outputToken = new CancellationTokenProxy(sourceOutput.Token);

                    var inputs  = new object[] { inputToken };
                    var outputs = new OperationInfo {
                        Token = outputToken
                    };

                    _operationManager
                    .Setup(m => m.BeforeCall(_operation.FullName, inputToken))
                    .Returns(outputs);

                    var actual = (OperationInfo)_sut.BeforeCall(_operationName, inputs);

                    _operationManager.VerifyAll();
                    Assert.AreEqual(outputs, actual);
                    Assert.AreEqual(outputToken, inputs[0]);
                }
        }
Exemplo n.º 2
0
        public void AfterCall(OperationInfo operation)
        {
            operation.IsNotNull(nameof(operation));

            operation.TokenRegistration?.Dispose();
        }