@@ -123,7 +123,7 @@ public Activity VerifyActivityRecordedOnce()
123
123
124
124
public static class ActivityAssert
125
125
{
126
- public static KeyValuePair < string , object > HasTag ( Activity activity , string name )
126
+ public static KeyValuePair < string , object > HasTag ( this Activity activity , string name )
127
127
{
128
128
KeyValuePair < string , object > tag = activity . TagObjects . SingleOrDefault ( t => t . Key == name ) ;
129
129
if ( tag . Key is null )
@@ -134,7 +134,7 @@ public static KeyValuePair<string, object> HasTag(Activity activity, string name
134
134
return tag ;
135
135
}
136
136
137
- public static void HasTag < T > ( Activity activity , string name , T expectedValue )
137
+ public static void HasTag < T > ( this Activity activity , string name , T expectedValue )
138
138
{
139
139
KeyValuePair < string , object > tag = HasTag ( activity , name ) ;
140
140
Assert . Equal ( expectedValue , ( T ) tag . Value ) ;
@@ -147,14 +147,19 @@ public static void HasRecordedException(this Activity activity, Exception except
147
147
Assert . Equal ( exception . GetType ( ) . ToString ( ) ,
148
148
exceptionEvent . Tags . SingleOrDefault ( t => t . Key == "exception.type" ) . Value ) ;
149
149
}
150
+
151
+ public static void IsInError ( this Activity activity )
152
+ {
153
+ Assert . Equal ( ActivityStatusCode . Error , activity . Status ) ;
154
+ }
150
155
151
- public static void HasNoTag ( Activity activity , string name )
156
+ public static void HasNoTag ( this Activity activity , string name )
152
157
{
153
158
bool contains = activity . TagObjects . Any ( t => t . Key == name ) ;
154
159
Assert . False ( contains , $ "The Activity tags should not contain { name } .") ;
155
160
}
156
161
157
- public static void FinishedInOrder ( Activity first , Activity second )
162
+ public static void FinishedInOrder ( this Activity first , Activity second )
158
163
{
159
164
Assert . True ( first . StartTimeUtc + first . Duration < second . StartTimeUtc + second . Duration ,
160
165
$ "{ first . OperationName } should stop before { second . OperationName } ") ;
0 commit comments