@@ -14,23 +14,36 @@ public class ResponseRegistryItem
1414 public Endpoint Endpoint ;
1515 public RequestMatcher RequestMatcher ;
1616 public ResponseCreator ResponseCreator ;
17+ public string Method ;
1718 public string RequestPath ;
1819 public string QueryString ;
1920 public string RequestBody ;
2021 public string ResponseBody ;
2122 public string Error ;
2223 public bool SingleMatch ;
2324
24- public void WriteToConsole ( )
25+ public void WriteIncomingInfoToConsole ( )
2526 {
26- Console . WriteLine ( $ "{ Timestamp . ToString ( "HH:mm:ss.fff" ) } { RequestPath } { Endpoint ? . Name } { Error } ") ;
27+ Console . WriteLine ( $ "[{ Id } ] { Timestamp . ToString ( "HH:mm:ss.fff" ) } { Method } { RequestPath } ") ;
28+ }
29+
30+ public void WriteResolvedInfoToConsole ( )
31+ {
32+ if ( Endpoint != null )
33+ {
34+ Console . WriteLine ( $ "[{ Id } ] Endpoint: { Endpoint . Name } ") ;
35+ }
2736 if ( RequestMatcher != null )
2837 {
29- Console . WriteLine ( " " + RequestMatcher . ToString ( ) ) ;
38+ Console . WriteLine ( $ "[ { Id } ] Request matcher: { RequestMatcher } " ) ;
3039 }
3140 if ( ResponseCreator != null )
3241 {
33- Console . WriteLine ( " " + ResponseCreator . ToString ( ) ) ;
42+ Console . WriteLine ( $ "[{ Id } ] Response creator: { ResponseCreator } ") ;
43+ }
44+ if ( Error != null )
45+ {
46+ Console . WriteLine ( $ "[{ Id } ] Error: { Error } ") ;
3447 }
3548 }
3649 }
@@ -65,7 +78,7 @@ public void Clear()
6578 public IEnumerable < ResponseRegistryItem > Responses => _items . Reverse < ResponseRegistryItem > ( ) ;
6679
6780 [ MethodImpl ( MethodImplOptions . Synchronized ) ]
68- public void Add ( ResponseRegistryItem responseRegistryItem )
81+ public ResponseRegistryItem Add ( ResponseRegistryItem responseRegistryItem )
6982 {
7083 Debug . Assert ( responseRegistryItem . Id == 0 ) ;
7184 responseRegistryItem . Id = ++ _nextId ;
@@ -74,6 +87,7 @@ public void Add(ResponseRegistryItem responseRegistryItem)
7487 _items . Dequeue ( ) ;
7588 }
7689 _items . Enqueue ( responseRegistryItem ) ;
90+ return responseRegistryItem ;
7791 }
7892 }
7993}
0 commit comments