@@ -30,10 +30,13 @@ public void Protocol_Default_VerifyAttributes()
3030 Environment = "my-environment" ,
3131 Release = "my-release" ,
3232 } ;
33- var sdk = new SdkVersion
33+ var scope = new Scope ( options )
3434 {
35- Name = "Sentry.Test.SDK" ,
36- Version = "1.2.3-test+Sentry"
35+ Sdk =
36+ {
37+ Name = "Sentry.Test.SDK" ,
38+ Version = "1.2.3-test+Sentry" ,
39+ }
3740 } ;
3841
3942 var log = new SentryLog ( Timestamp , TraceId , ( SentryLogLevel ) 24 , "message" )
@@ -43,7 +46,7 @@ public void Protocol_Default_VerifyAttributes()
4346 ParentSpanId = ParentSpanId ,
4447 } ;
4548 log . SetAttribute ( "attribute" , "value" ) ;
46- log . SetDefaultAttributes ( options , sdk ) ;
49+ log . SetDefaultAttributes ( options , scope ) ;
4750
4851 log . Timestamp . Should ( ) . Be ( Timestamp ) ;
4952 log . TraceId . Should ( ) . Be ( TraceId ) ;
@@ -63,9 +66,9 @@ public void Protocol_Default_VerifyAttributes()
6366 log . TryGetAttribute ( "sentry.release" , out string release ) . Should ( ) . BeTrue ( ) ;
6467 release . Should ( ) . Be ( options . Release ) ;
6568 log . TryGetAttribute ( "sentry.sdk.name" , out string name ) . Should ( ) . BeTrue ( ) ;
66- name . Should ( ) . Be ( sdk . Name ) ;
69+ name . Should ( ) . Be ( scope . Sdk . Name ) ;
6770 log . TryGetAttribute ( "sentry.sdk.version" , out string version ) . Should ( ) . BeTrue ( ) ;
68- version . Should ( ) . Be ( sdk . Version ) ;
71+ version . Should ( ) . Be ( scope . Sdk . Version ) ;
6972 log . TryGetAttribute ( "not-found" , out object notFound ) . Should ( ) . BeFalse ( ) ;
7073 notFound . Should ( ) . BeNull ( ) ;
7174 }
@@ -81,18 +84,15 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
8184 Release = "my-release" ,
8285 ServerName = hasAdditionalDefaultAttributes ? "my-server-address" : null ,
8386 } ;
84- var sdk = new SdkVersion
85- {
86- Name = "Sentry.Test.SDK" ,
87- Version = "1.2.3-test+Sentry"
88- } ;
89-
90- var replaySession = Substitute . For < IReplaySession > ( ) ;
91- replaySession . ActiveReplayId . Returns ( hasAdditionalDefaultAttributes ? SentryId . Create ( ) : SentryId . Empty ) ;
92- var hub = Substitute . For < IHub > ( ) ;
9387 var scope = new Scope ( options ) ;
88+
9489 if ( hasAdditionalDefaultAttributes )
9590 {
91+ options . Dsn = ValidDsn ;
92+ var replaySession = Substitute . For < IReplaySession > ( ) ;
93+ replaySession . ActiveReplayId . Returns ( SentryId . Parse ( "f18176ecbb544e549fd23fbbe39064cc" ) ) ;
94+ _ = scope . PropagationContext . GetOrCreateDynamicSamplingContext ( options , replaySession ) ;
95+
9696 scope . User = new SentryUser
9797 {
9898 Id = "my-user-id" ,
@@ -107,7 +107,6 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
107107 scope . Contexts . Device . Model = "my-device-model" ;
108108 scope . Contexts . Device . Family = "my-device-family" ;
109109 }
110- hub . SubstituteConfigureScope ( scope ) ;
111110
112111 var log = new SentryLog ( Timestamp , TraceId , ( SentryLogLevel ) 24 , "message" )
113112 {
@@ -116,7 +115,7 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
116115 ParentSpanId = ParentSpanId ,
117116 } ;
118117 log . SetAttribute ( "attribute" , "value" ) ;
119- log . SetDefaultAttributes ( options , sdk , replaySession , hub ) ;
118+ log . SetDefaultAttributes ( options , scope ) ;
120119
121120 log . TryGetAttribute ( "sentry.replay_id" , out string replayId ) . Should ( ) . Be ( hasAdditionalDefaultAttributes ) ;
122121 log . TryGetAttribute ( "user.id" , out string userId ) . Should ( ) . Be ( hasAdditionalDefaultAttributes ) ;
@@ -133,7 +132,7 @@ public void Protocol_Default_VerifyAdditionalAttributes(bool hasAdditionalDefaul
133132
134133 if ( hasAdditionalDefaultAttributes )
135134 {
136- replayId . Should ( ) . Be ( replaySession . ActiveReplayId . ToString ( ) ) ;
135+ replayId . Should ( ) . Be ( "f18176ecbb544e549fd23fbbe39064cc" ) ;
137136 userId . Should ( ) . Be ( "my-user-id" ) ;
138137 userName . Should ( ) . Be ( "my-user-name" ) ;
139138 userEmail . Should ( ) . Be ( "my-user-email" ) ;
@@ -181,9 +180,10 @@ public void WriteTo_Envelope_MinimalSerializedSentryLog()
181180 Release = "my-release" ,
182181 SendDefaultPii = false ,
183182 } ;
183+ var scope = new Scope ( options ) ;
184184
185185 var log = new SentryLog ( Timestamp , TraceId , SentryLogLevel . Trace , "message" ) ;
186- log . SetDefaultAttributes ( options , new SdkVersion ( ) ) ;
186+ log . SetDefaultAttributes ( options , scope ) ;
187187
188188 var envelope = Envelope . FromLog ( new StructuredLog ( [ log ] ) ) ;
189189
@@ -251,13 +251,19 @@ public void WriteTo_EnvelopeItem_MaximalSerializedSentryLog()
251251 Release = "my-release" ,
252252 ServerName = "my-server-address" ,
253253 } ;
254-
255254 var replaySession = Substitute . For < IReplaySession > ( ) ;
256255 var replayId = SentryId . Create ( ) ;
257256 replaySession . ActiveReplayId . Returns ( replayId ) ;
258- var hub = Substitute . For < IHub > ( ) ;
259- var scope = new Scope ( options )
257+ var dynamicSamplingContext = DynamicSamplingContext . Empty ( ) ;
258+ dynamicSamplingContext . SetReplayId ( replaySession ) ;
259+ var propagationContext = new SentryPropagationContext ( TraceId , ParentSpanId ! . Value , dynamicSamplingContext ) ;
260+ var scope = new Scope ( options , propagationContext )
260261 {
262+ Sdk =
263+ {
264+ Name = "Sentry.Test.SDK" ,
265+ Version = "1.2.3-test+Sentry" ,
266+ } ,
261267 User = new SentryUser
262268 {
263269 Id = "my-user-id" ,
@@ -284,7 +290,6 @@ public void WriteTo_EnvelopeItem_MaximalSerializedSentryLog()
284290 } ,
285291 } ,
286292 } ;
287- hub . SubstituteConfigureScope ( scope ) ;
288293
289294 var log = new SentryLog ( Timestamp , TraceId , ( SentryLogLevel ) 24 , "message" )
290295 {
@@ -296,7 +301,7 @@ public void WriteTo_EnvelopeItem_MaximalSerializedSentryLog()
296301 log . SetAttribute ( "boolean-attribute" , true ) ;
297302 log . SetAttribute ( "integer-attribute" , 3 ) ;
298303 log . SetAttribute ( "double-attribute" , 4.4 ) ;
299- log . SetDefaultAttributes ( options , new SdkVersion { Name = "Sentry.Test.SDK" , Version = "1.2.3-test+Sentry" } , replaySession , hub ) ;
304+ log . SetDefaultAttributes ( options , scope ) ;
300305
301306 var envelope = EnvelopeItem . FromLog ( new StructuredLog ( [ log ] ) ) ;
302307
0 commit comments