public void ShouldRecordErrorAndThrowOnAssertNoProtocolViolation() { var pipeline = new ResponsePipeline(null); var(code, message) = ("Neo.ClientError.Request.Invalid", "protocol exception."); var(msg, handler) = (new Mock <IRequestMessage>(), new Mock <IResponseHandler>()); pipeline.Enqueue(msg.Object, handler.Object); pipeline.OnFailure(code, message); var exc = Record.Exception(() => pipeline.AssertNoProtocolViolation()); exc.Should().BeOfType <ProtocolException>().Which .Message.Should().Be("protocol exception."); }
public void ShouldInvokeHandler() { var pipeline = new ResponsePipeline(null); var(code, message) = ("Neo.TransientError.Transaction.Terminated", "transaction terminated."); var(msg, handler) = (new Mock <IRequestMessage>(), new Mock <IResponseHandler>()); pipeline.Enqueue(msg.Object, handler.Object); pipeline.OnFailure(code, message); handler.Verify( x => x.OnFailure(It.Is <IResponsePipelineError>(e => e.Is(t => t is TransientException && t.Message.Equals("transaction terminated.")))), Times.Once); }