@@ -130,6 +130,7 @@ public static KeyValuePair<string, object> HasTag(Activity activity, string name
130130 {
131131 Assert . Fail ( $ "The Activity tags should contain { name } .") ;
132132 }
133+
133134 return tag ;
134135 }
135136
@@ -139,6 +140,14 @@ public static void HasTag<T>(Activity activity, string name, T expectedValue)
139140 Assert . Equal ( expectedValue , ( T ) tag . Value ) ;
140141 }
141142
143+ public static void HasRecordedException ( this Activity activity , Exception exception )
144+ {
145+ var exceptionEvent = activity . Events . First ( ) ;
146+ Assert . Equal ( "exception" , activity . Events . First ( ) . Name ) ;
147+ Assert . Equal ( exception . GetType ( ) . ToString ( ) ,
148+ exceptionEvent . Tags . SingleOrDefault ( t => t . Key == "exception.type" ) . Value ) ;
149+ }
150+
142151 public static void HasNoTag ( Activity activity , string name )
143152 {
144153 bool contains = activity . TagObjects . Any ( t => t . Key == name ) ;
@@ -147,7 +156,8 @@ public static void HasNoTag(Activity activity, string name)
147156
148157 public static void FinishedInOrder ( Activity first , Activity second )
149158 {
150- Assert . True ( first . StartTimeUtc + first . Duration < second . StartTimeUtc + second . Duration , $ "{ first . OperationName } should stop before { second . OperationName } ") ;
159+ Assert . True ( first . StartTimeUtc + first . Duration < second . StartTimeUtc + second . Duration ,
160+ $ "{ first . OperationName } should stop before { second . OperationName } ") ;
151161 }
152162
153163 public static string CamelToSnake ( string camel )
@@ -162,8 +172,10 @@ public static string CamelToSnake(string camel)
162172 {
163173 bld . Append ( '_' ) ;
164174 }
175+
165176 bld . Append ( char . ToLower ( c ) ) ;
166177 }
178+
167179 return bld . ToString ( ) ;
168180 }
169181 }
0 commit comments