@@ -78,13 +78,13 @@ public void GetDevice_Identifies_iOS(string ua, string expected)
7878 }
7979
8080 [ TestCase ( "Mozilla/5.0 (Linux; Android 12; Pixel 6 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/94.0.4606.61 Mobile Safari/537.36" , "Android Phone (Pixel 6)" ) ]
81- [ TestCase ( "Mozilla/5.0 (Linux; Android 10; SM-G973F Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36" , "Android Phone ( SM-G973F) " ) ]
82- [ TestCase ( "Mozilla/5.0 (Linux; Android 10; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36" , "Android Phone " ) ]
81+ [ TestCase ( "Mozilla/5.0 (Linux; Android 10; SM-G973F Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36" , "Samsung SM-G973F" ) ]
82+ [ TestCase ( "Mozilla/5.0 (Linux; Android 10; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36" , "Samsung SM-G973F " ) ]
8383 [ TestCase ( "Mozilla/5.0 (Linux; Android 13; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36" , "Samsung Galaxy S20" ) ]
8484 [ TestCase ( "Mozilla/5.0 (Linux; Android 13; SM-S918B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36" , "Samsung Galaxy S23 Ultra" ) ]
8585 [ TestCase ( "Mozilla/5.0 (Linux; Android 13; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36" , "Samsung SM-A556B" ) ]
8686 [ TestCase ( "Mozilla/5.0 (Linux; Android 13; SM-R960) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36" , "Samsung Galaxy Watch6 Classic 47mm" ) ]
87- [ TestCase ( "Mozilla/5.0 (Linux; Android 11; SM-T970 Build/RP1A.200720.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.93 Safari/537.36" , "Android Tablet ( SM-T970) " ) ]
87+ [ TestCase ( "Mozilla/5.0 (Linux; Android 11; SM-T970 Build/RP1A.200720.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.93 Safari/537.36" , "Samsung SM-T970" ) ]
8888 [ TestCase ( "Mozilla/5.0 (Linux; Android 13; Tablet; rv:102.0) Gecko/102.0 Firefox/102.0" , "Android Tablet" ) ]
8989 public void GetDevice_Identifies_Android ( string ua , string expected )
9090 {
@@ -119,5 +119,66 @@ public void GetDeviceInfo_Identifies_SamsungWatch_Enum()
119119 var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
120120 Assert . That ( info . Type , Is . EqualTo ( UserAgentDeviceType . SamsungWatch ) ) ;
121121 }
122+
123+ [ Test ]
124+ public void GetDeviceInfo_Samsung_U1_Suffix_IsExtracted_WhenWvPresent ( )
125+ {
126+ const string ua = "Mozilla/5.0 (Linux; Android 14; wv; SM-S928U1 Build/UQ1A.240105.004) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/120.0.0.0 Mobile Safari/537.36" ;
127+ var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
128+
129+ using ( Assert . EnterMultipleScope ( ) )
130+ {
131+ Assert . That ( info . Type , Is . EqualTo ( UserAgentDeviceType . SamsungPhone ) ) ;
132+ Assert . That ( info . FriendlyName , Does . Contain ( "Samsung" ) ) ;
133+ Assert . That ( info . Model , Is . Not . Empty ) ;
134+ }
135+ }
136+
137+ [ Test ]
138+ public void GetDeviceInfo_AppleMachineId_IsResolved_FromWholeString ( )
139+ {
140+ const string ua = "SomeApp/1.0 (iPhone17,2; iOS 18.0)" ;
141+ var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
142+
143+ using ( Assert . EnterMultipleScope ( ) )
144+ {
145+ Assert . That ( info . Type , Is . EqualTo ( UserAgentDeviceType . ApplePhone ) ) ;
146+ Assert . That ( info . FriendlyName , Is . Not . Empty ) ;
147+ }
148+ }
149+
150+ [ Test ]
151+ public void GetDeviceInfo_OnePlus_CPH_IsResolved ( )
152+ {
153+ const string ua = "Mozilla/5.0 (Linux; Android 13; CPH2581) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36" ;
154+ var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
155+
156+ using ( Assert . EnterMultipleScope ( ) )
157+ {
158+ Assert . That ( info . Type , Is . EqualTo ( UserAgentDeviceType . OnePlusPhone ) ) ;
159+ Assert . That ( info . FriendlyName , Does . Contain ( "OnePlus" ) ) ;
160+ }
161+ }
162+
163+ [ Test ]
164+ public void GetDeviceInfo_XiaomiSku_IsResolved ( )
165+ {
166+ const string ua = "Mozilla/5.0 (Linux; Android 14; 23127PN0CG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36" ;
167+ var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
168+
169+ using ( Assert . EnterMultipleScope ( ) )
170+ {
171+ Assert . That ( info . Type , Is . EqualTo ( UserAgentDeviceType . XiaomiPhone ) ) ;
172+ Assert . That ( info . FriendlyName , Is . Not . Empty ) ;
173+ }
174+ }
175+
176+ [ Test ]
177+ public void GetDeviceInfo_OkHttp_IsNotClassifiedAsScript ( )
178+ {
179+ const string ua = "okhttp/3.12.1" ;
180+ var info = UserAgentHelpers . GetDeviceInfo ( ua ) ;
181+ Assert . That ( info . Type , Is . Not . EqualTo ( UserAgentDeviceType . Script ) ) ;
182+ }
122183 }
123184}
0 commit comments