LCOV - code coverage report
Current view: top level - Cqrs.WebApi/SignalR/Hubs - SignalRStartUp.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 4 0.0 %
Date: 2017-07-26

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="cdmdotnet Limited">
       4             : // //   Copyright cdmdotnet Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System.Web.Http;
      10             : using Cqrs.Configuration;
      11             : using Microsoft.AspNet.SignalR;
      12             : using Microsoft.Owin;
      13             : using Microsoft.Owin.Cors;
      14             : using Newtonsoft.Json;
      15             : using Owin;
      16             : 
      17             : [assembly: OwinStartup("Cqrs.WebApi.SignalR.Hubs.SignalRStartUp", typeof(Cqrs.WebApi.SignalR.Hubs.SignalRStartUp))]
      18             : namespace Cqrs.WebApi.SignalR.Hubs
      19             : {
      20             :         public class SignalRStartUp
      21           0 :         {
      22             :                 public IConfigurationManager ConfigurationManager { get; set; }
      23             : 
      24           0 :                 public SignalRStartUp()
      25             :                         :this (new ConfigurationManager())
      26             :                 {
      27             :                 }
      28             : 
      29           0 :                 public SignalRStartUp(IConfigurationManager configurationManager)
      30             :                 {
      31             :                         ConfigurationManager = configurationManager;
      32             :                 }
      33             : 
      34           0 :                 public virtual void Configuration(IAppBuilder app)
      35             :                 {
      36             :                         string url;
      37             :                         if (!ConfigurationManager.TryGetSetting("Cqrs.WebApi.SignalR.EndpointPath", out url) || string.IsNullOrWhiteSpace(url))
      38             :                                 url = "/signalr";
      39             :                         // Branch the pipeline here for requests that start with "/signalr"
      40             :                         app.Map(url, map =>
      41             :                         {
      42             :                                 // Setup the CORS middleware to run before SignalR.
      43             :                                 // By default this will allow all origins. You can 
      44             :                                 // configure the set of origins and/or http verbs by
      45             :                                 // providing a cors options with a different policy.
      46             :                                 map.UseCors(CorsOptions.AllowAll);
      47             :                                 var hubConfiguration = new HubConfiguration
      48             :                                 {
      49             :                                         // You can enable JSONP by un-commenting line below.
      50             :                                         // JSONP requests are insecure but some older browsers (and some
      51             :                                         // versions of IE) require JSONP to work cross domain
      52             :                                         // EnableJSONP = true
      53             :                                         EnableDetailedErrors = true,
      54             : //                                      Resolver = new SignalRResolver()
      55             :                                 };
      56             :                                 // Run the SignalR pipeline. We're not using MapSignalR
      57             :                                 // since this branch already runs under the "/signalr"
      58             :                                 // path.
      59             :                                 map.RunSignalR(hubConfiguration);
      60             :                         });
      61             : 
      62             :                         JsonSerializer serializer = JsonSerializer.Create
      63             :                         (
      64             :                                 new JsonSerializerSettings
      65             :                                 {
      66             :                                         Formatting = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Formatting,
      67             :                                         MissingMemberHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.MissingMemberHandling,
      68             :                                         DateParseHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateParseHandling,
      69             :                                         DateTimeZoneHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling,
      70             :                                         Converters = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Converters,
      71             :                                         ContractResolver = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver,
      72             :                                         DateFormatHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling,
      73             :                                         DefaultValueHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling,
      74             :                                         FloatFormatHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.FloatFormatHandling,
      75             :                                         NullValueHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.NullValueHandling,
      76             :                                         PreserveReferencesHandling = PreserveReferencesHandling.None,
      77             :                                         ReferenceLoopHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling,
      78             :                                         StringEscapeHandling = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.StringEscapeHandling,
      79             :                                         TypeNameHandling = TypeNameHandling.None
      80             :                                 }
      81             :                         );
      82             :                         GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);
      83             :                 }
      84             :         }
      85             : }

Generated by: LCOV version 1.10