Exemplo n.º 1
0
 public void Detect()
 {
     foreach (var accessor in Accessors)
     {
         var contextService   = new HttpContextService(accessor);
         var userAgentService = new UserAgentService(contextService);
         var deviceService    = new DeviceService(userAgentService);
         _ = deviceService.Type;
     }
 }
 public void Detect()
 {
     foreach (var accessor in Accessors)
     {
         var contextService   = new HttpContextService(accessor);
         var userAgentService = new UserAgentService(contextService);
         var platformService  = new PlatformService(userAgentService);
         var engineService    = new EngineService(userAgentService, platformService);
         var browserService   = new BrowserService(userAgentService, engineService);
         var deviceService    = new DeviceService(userAgentService);
         _ = browserService.Name;
         _ = browserService.Version;
         _ = deviceService.Type;
     }
 }
Exemplo n.º 3
0
        public void Ctor_IServiceProvider_Success()
        {
            var agent   = "Agent";
            var context = new DefaultHttpContext();

            context.Request.Headers["User-Agent"] = agent;

            var accessor = new HttpContextAccessor {
                HttpContext = context
            };
            var contextService = new HttpContextService(accessor);

            var useragentService = new UserAgentService(contextService);

            Assert.NotNull(useragentService.UserAgent);
            Assert.Equal(agent, useragentService.UserAgent.ToString());
        }