@@ -183,6 +183,35 @@ public IEnumerator Process_OperatingSystemProtocol_Assigned()
183
183
Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . OperatingSystem , sentryEvent . Contexts . OperatingSystem . Name ) ;
184
184
}
185
185
186
+ [ UnityTest ]
187
+ public IEnumerator Process_DeviceProtocol_Assigned ( )
188
+ {
189
+ const long toByte = 1048576L ; // in `UnityEventProcessor.PopulateDevice`
190
+ _sentryMonoBehaviour . SentrySystemInfo = new TestSentrySystemInfo
191
+ {
192
+ ProcessorCount = 1 ,
193
+ DeviceType = "Console" ,
194
+ CpuDescription = "Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz" ,
195
+ SupportsVibration = true ,
196
+ DeviceName = "hostname" ,
197
+ DeviceModel = new Lazy < string > ( ( ) => "Samsung Galaxy S3" ) ,
198
+ SystemMemorySize = 16000
199
+ } ;
200
+ var sut = new UnityEventProcessor ( _sentryOptions , _sentryMonoBehaviourGenerator , _testApplication ) ;
201
+ var sentryEvent = new SentryEvent ( ) ;
202
+
203
+ yield return _sentryMonoBehaviour . CollectData ( ) ;
204
+ sut . Process ( sentryEvent ) ;
205
+
206
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . ProcessorCount , sentryEvent . Contexts . Device . ProcessorCount ) ;
207
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . DeviceType , sentryEvent . Contexts . Device . DeviceType ) ;
208
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . CpuDescription , sentryEvent . Contexts . Device . CpuDescription ) ;
209
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . SupportsVibration , sentryEvent . Contexts . Device . SupportsVibration ) ;
210
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . DeviceName , sentryEvent . Contexts . Device . Name ) ;
211
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . DeviceModel ? . Value , sentryEvent . Contexts . Device . Model ) ;
212
+ Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . SystemMemorySize * toByte , sentryEvent . Contexts . Device . MemorySize ) ;
213
+ }
214
+
186
215
[ UnityTest ]
187
216
public IEnumerator Process_GpuProtocol_Assigned ( )
188
217
{
@@ -292,7 +321,7 @@ internal sealed class TestSentrySystemInfo : ISentrySystemInfo
292
321
public string ? CpuDescription { get ; set ; }
293
322
public string ? DeviceName { get ; set ; }
294
323
public string ? DeviceUniqueIdentifier { get ; set ; }
295
- public string ? DeviceModel { get ; set ; }
324
+ public Lazy < string > ? DeviceModel { get ; set ; }
296
325
public int ? SystemMemorySize { get ; set ; }
297
326
public int ? GraphicsDeviceId { get ; set ; }
298
327
public string ? GraphicsDeviceName { get ; set ; }
0 commit comments