예제 #1
0
        public void Ctor(string name, HttpUserAgentPlatformType platform)
        {
            Regex regex = new("");

            HttpUserAgentPlatformInformation info = new(regex, name, platform);

            info.Regex.Should().Be(regex);
            info.Name.Should().Be(name);
            info.PlatformType.Should().Be(platform);
        }
예제 #2
0
 /// <summary>
 /// Creates a new instance of <see cref="HttpUserAgentPlatformInformation"/>
 /// </summary>
 public HttpUserAgentPlatformInformation(Regex regex, string name, HttpUserAgentPlatformType platformType)
 {
     Regex        = regex;
     Name         = name;
     PlatformType = platformType;
 }
예제 #3
0
 public void TestValue(HttpUserAgentPlatformType type, byte value)
 {
     ((byte)type == value).Should().Be(true);
 }
        public void BrowserTests(string ua, string name, string version, string platformName, HttpUserAgentPlatformType platformType, string mobileDeviceType)
        {
            HttpUserAgentInformation uaInfo = HttpUserAgentInformation.Parse(ua);

            uaInfo.Name.Should().Be(name);
            uaInfo.Version.Should().Be(version);
            uaInfo.UserAgent.Should().Be(ua);

            uaInfo.Type.Should().Be(HttpUserAgentType.Browser);

            HttpUserAgentPlatformInformation platform = uaInfo.Platform.GetValueOrDefault();

            platform.PlatformType.Should().Be(platformType);
            platform.Name.Should().Be(platformName);

            uaInfo.MobileDeviceType.Should().Be(mobileDeviceType);

            uaInfo.IsBrowser().Should().Be(true);
            uaInfo.IsMobile().Should().Be(mobileDeviceType is not null);
            uaInfo.IsRobot().Should().Be(false);
        }