コード例 #1
0
        public void Parse(string userAgent)
        {
            HttpUserAgentInformation ua1 = HttpUserAgentParser.Parse(userAgent);
            HttpUserAgentInformation ua2 = HttpUserAgentInformation.Parse(userAgent);

            ua1.Should().BeEquivalentTo(ua2);
        }
コード例 #2
0
        public void Parse()
        {
            string[] testUserAgentMix          = _testUserAgentMix;
            HttpUserAgentInformation[] results = _results;

            for (int i = 0; i < testUserAgentMix.Length; ++i)
            {
                results[i] = HttpUserAgentParser.Parse(testUserAgentMix[i]);
            }
        }
コード例 #3
0
        /// <inheritdoc/>
        public HttpUserAgentInformation Parse(string userAgent)
        {
            CacheKey key = this.GetKey(userAgent);

            return(_memoryCache.GetOrCreate(key, static entry =>
            {
                CacheKey key = (entry.Key as CacheKey) !;
                entry.SlidingExpiration = key.Options.CacheEntryOptions.SlidingExpiration;
                entry.SetSize(1);

                return HttpUserAgentParser.Parse(key.UserAgent);
            }));
        }
 /// <summary>
 /// returns the result of <see cref="HttpUserAgentParser.Parse"/>
 /// </summary>
 public HttpUserAgentInformation Parse(string userAgent)
 => HttpUserAgentParser.Parse(userAgent);