@@ -130,6 +130,7 @@ public static KeyValuePair<string, object> HasTag(Activity activity, string name
130
130
{
131
131
Assert . Fail ( $ "The Activity tags should contain { name } .") ;
132
132
}
133
+
133
134
return tag ;
134
135
}
135
136
@@ -139,6 +140,14 @@ public static void HasTag<T>(Activity activity, string name, T expectedValue)
139
140
Assert . Equal ( expectedValue , ( T ) tag . Value ) ;
140
141
}
141
142
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
+
142
151
public static void HasNoTag ( Activity activity , string name )
143
152
{
144
153
bool contains = activity . TagObjects . Any ( t => t . Key == name ) ;
@@ -147,7 +156,8 @@ public static void HasNoTag(Activity activity, string name)
147
156
148
157
public static void FinishedInOrder ( Activity first , Activity second )
149
158
{
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 } ") ;
151
161
}
152
162
153
163
public static string CamelToSnake ( string camel )
@@ -162,8 +172,10 @@ public static string CamelToSnake(string camel)
162
172
{
163
173
bld . Append ( '_' ) ;
164
174
}
175
+
165
176
bld . Append ( char . ToLower ( c ) ) ;
166
177
}
178
+
167
179
return bld . ToString ( ) ;
168
180
}
169
181
}
0 commit comments