11using System ;
22using System . Threading ;
33using NUnit . Framework ;
4+ using Sentry . Unity ;
45
56namespace Sentry . Unity . Android . Tests
67{
@@ -9,7 +10,7 @@ public class SentryNativeAndroidTests
910 private bool _reinstallCalled ;
1011 private Action ? _originalReinstallSentryNativeBackendStrategy ;
1112 private Action _fakeReinstallSentryNativeBackendStrategy ;
12- private bool _il2cpp ;
13+ private TestSentryUnityInfo _sentryUnityInfo = null ! ;
1314
1415 public SentryNativeAndroidTests ( )
1516 => _fakeReinstallSentryNativeBackendStrategy = ( ) => _reinstallCalled = true ;
@@ -21,7 +22,7 @@ public void SetUp()
2122 Interlocked . Exchange ( ref SentryNative . ReinstallSentryNativeBackendStrategy ,
2223 _fakeReinstallSentryNativeBackendStrategy ) ;
2324 _reinstallCalled = false ;
24- _il2cpp = false ;
25+ _sentryUnityInfo = new TestSentryUnityInfo { IL2CPP = false } ;
2526 }
2627
2728 [ TearDown ]
@@ -34,39 +35,39 @@ public void TearDown() =>
3435 public void Configure_DefaultConfiguration_SetsScopeObserver ( )
3536 {
3637 var options = new SentryUnityOptions ( ) ;
37- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
38+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
3839 Assert . IsAssignableFrom < AndroidJavaScopeObserver > ( options . ScopeObserver ) ;
3940 }
4041
4142 [ Test ]
4243 public void Configure_DefaultConfiguration_SetsCrashedLastRun ( )
4344 {
4445 var options = new SentryUnityOptions ( ) ;
45- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
46+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
4647 Assert . IsNotNull ( options . CrashedLastRun ) ;
4748 }
4849
4950 [ Test ]
5051 public void Configure_NativeAndroidSupportDisabled_ObserverIsNull ( )
5152 {
5253 var options = new SentryUnityOptions { AndroidNativeSupportEnabled = false } ;
53- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
54+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
5455 Assert . Null ( options . ScopeObserver ) ;
5556 }
5657
5758 [ Test ]
5859 public void Configure_DefaultConfiguration_EnablesScopeSync ( )
5960 {
6061 var options = new SentryUnityOptions ( ) ;
61- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
62+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
6263 Assert . True ( options . EnableScopeSync ) ;
6364 }
6465
6566 [ Test ]
6667 public void Configure_NativeAndroidSupportDisabled_DisabledScopeSync ( )
6768 {
6869 var options = new SentryUnityOptions { AndroidNativeSupportEnabled = false } ;
69- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
70+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
7071 Assert . False ( options . EnableScopeSync ) ;
7172 }
7273
@@ -75,10 +76,10 @@ public void Configure_NativeAndroidSupportDisabled_DisabledScopeSync()
7576 [ TestCase ( false , false ) ]
7677 public void Configure_IL2CPP_ReInitializesNativeBackendOnlyOnIL2CPP ( bool il2cpp , bool expectedReinstall )
7778 {
78- _il2cpp = il2cpp ;
79+ _sentryUnityInfo . IL2CPP = il2cpp ;
7980 Assert . False ( _reinstallCalled ) ; // Sanity check
8081
81- SentryNativeAndroid . Configure ( new ( ) , _il2cpp ) ;
82+ SentryNativeAndroid . Configure ( new ( ) , _sentryUnityInfo ) ;
8283
8384 Assert . AreEqual ( expectedReinstall , _reinstallCalled ) ;
8485 }
@@ -87,8 +88,13 @@ public void Configure_IL2CPP_ReInitializesNativeBackendOnlyOnIL2CPP(bool il2cpp,
8788 public void Configure_NativeAndroidSupportDisabled_DoesNotReInitializeNativeBackend ( )
8889 {
8990 var options = new SentryUnityOptions { AndroidNativeSupportEnabled = false } ;
90- SentryNativeAndroid . Configure ( options , _il2cpp ) ;
91+ SentryNativeAndroid . Configure ( options , _sentryUnityInfo ) ;
9192 Assert . False ( _reinstallCalled ) ;
9293 }
9394 }
95+
96+ public class TestSentryUnityInfo : ISentryUnityInfo
97+ {
98+ public bool IL2CPP { get ; set ; }
99+ }
94100}
0 commit comments