@@ -51,6 +51,8 @@ public class UnaryServerCallHandlerBenchmarkBase
5151 protected InterceptorCollection ? Interceptors { get ; set ; }
5252 protected List < ICompressionProvider > ? CompressionProviders { get ; set ; }
5353 protected string ? ResponseCompressionAlgorithm { get ; set ; }
54+ protected Grpc . AspNetCore . Server . Model . UnaryServerMethod < TestService , ChatMessage , ChatMessage > ? Method { get ; set ; }
55+ protected string ExpectedStatus { get ; set ; } = "0" ;
5456
5557 [ GlobalSetup ]
5658 public void GlobalSetup ( )
@@ -75,7 +77,7 @@ public void GlobalSetup()
7577 var result = Task . FromResult ( message ) ;
7678 _callHandler = new UnaryServerCallHandler < TestService , ChatMessage , ChatMessage > (
7779 new UnaryServerMethodInvoker < TestService , ChatMessage , ChatMessage > (
78- ( service , request , context ) => result ,
80+ Method ?? ( ( service , request , context ) => result ) ,
7981 method ,
8082 HttpContextServerCallContextHelper . CreateMethodOptions (
8183 compressionProviders : CompressionProviders ,
@@ -135,7 +137,7 @@ protected async Task InvokeUnaryRequestAsync()
135137 StringValues value ;
136138 if ( _trailers . TryGetValue ( "grpc-status" , out value ) || _headers . TryGetValue ( "grpc-status" , out value ) )
137139 {
138- if ( ! value . Equals ( "0" ) )
140+ if ( ! value . Equals ( ExpectedStatus ) )
139141 {
140142 throw new InvalidOperationException ( "Unexpected grpc-status: " + Enum . Parse < StatusCode > ( value ) ) ;
141143 }
0 commit comments