@@ -183,6 +183,35 @@ public IEnumerator Process_OperatingSystemProtocol_Assigned()
183183 Assert . AreEqual ( _sentryMonoBehaviour . SentrySystemInfo . OperatingSystem , sentryEvent . Contexts . OperatingSystem . Name ) ;
184184 }
185185
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+
186215 [ UnityTest ]
187216 public IEnumerator Process_GpuProtocol_Assigned ( )
188217 {
@@ -292,7 +321,7 @@ internal sealed class TestSentrySystemInfo : ISentrySystemInfo
292321 public string ? CpuDescription { get ; set ; }
293322 public string ? DeviceName { get ; set ; }
294323 public string ? DeviceUniqueIdentifier { get ; set ; }
295- public string ? DeviceModel { get ; set ; }
324+ public Lazy < string > ? DeviceModel { get ; set ; }
296325 public int ? SystemMemorySize { get ; set ; }
297326 public int ? GraphicsDeviceId { get ; set ; }
298327 public string ? GraphicsDeviceName { get ; set ; }
0 commit comments