Ejemplo n.º 1
0
        public void Throw_operation_canceled_after_given_timeout()
        {
            var timeout = TimeSpan.FromSeconds(1);
            CancellationToken cancellationToken = new CancellationTokenSource(timeout).Token;
            GethTraceOptions  optionsMock       = Substitute.For <GethTraceOptions>();
            var tracer = new GethLikeTxTracer(optionsMock, cancellationToken);

            Thread.Sleep(TimeSpan.FromSeconds(2));

            Assert.Throws <OperationCanceledException>(() => tracer.ReportOperationRemainingGas(0));

            Assert.Throws <OperationCanceledException>(() => tracer.SetOperationMemorySize(0));

            Assert.Throws <OperationCanceledException>(() => tracer.StartOperation(0, 0, Instruction.ADD, 0));
        }