diff --git a/DeviceDetector.NET.Tests/DeviceDetectorTest.cs b/DeviceDetector.NET.Tests/DeviceDetectorTest.cs index 225613d..c6074ed 100644 --- a/DeviceDetector.NET.Tests/DeviceDetectorTest.cs +++ b/DeviceDetector.NET.Tests/DeviceDetectorTest.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using DeviceDetectorNET.Results.Client; using Xunit; namespace DeviceDetectorNET.Tests; @@ -788,4 +789,39 @@ public void TestIssue22_Test3() dd.Match.OsFamily.Should().Be("Mac"); dd.Match.DeviceType.Should().Be("desktop"); } + + /// + /// Issue #88 + /// + [Fact] + public void TestIssue88_Test1() + { + const string userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"; + var dd = DeviceDetector.GetInfoFromUserAgent(userAgent); + dd.Success.Should().BeTrue(); + var browserMatch = dd.Match.Client as BrowserMatchResult; + browserMatch.Should().Be("Chrome"); + browserMatch.Should().Be("131.0.0.0"); + browserMatch.EngineVersion.Should().Be("Blink"); + + } + /// + /// Issue #88 + /// + [Fact] + public void TestIssue88_Test2() + { + var clientHints = ClientHints.Factory(new Dictionary + { + ["sec-ch-ua"] = "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"", + }); + const string userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"; + var dd = DeviceDetector.GetInfoFromUserAgent(userAgent, clientHints); + dd.Success.Should().BeTrue(); + var browserMatch = dd.Match.Client as BrowserMatchResult; + browserMatch.Should().Be("360 Secure Browser"); + browserMatch.Should().Be("131.0.0.0"); + browserMatch.EngineVersion.Should().Be("Blink"); + + } } \ No newline at end of file diff --git a/DeviceDetector.NET/DeviceDetector.cs b/DeviceDetector.NET/DeviceDetector.cs index 309ba0a..5a8b059 100644 --- a/DeviceDetector.NET/DeviceDetector.cs +++ b/DeviceDetector.NET/DeviceDetector.cs @@ -672,7 +672,7 @@ protected void ParseDevice() osVersion = os.Match.Version; if (!string.IsNullOrEmpty(osVersion)) { - osVersion = !osVersion.Contains(".") ? osVersion + ".0" : osVersion; + osVersion = !osVersion.Contains('.') ? osVersion + ".0" : osVersion; } }