private IServiceCollection GetServices(ISocketManager <ISocketClient <Message, Message>, Message> manager,
                                               ISocketClient <Message, Message> gmClient)
        {
            IServiceCollection services = new ServiceCollection();
            var conf = new ServerConfiguration()
            {
                GMPort = 44360, ListenerIP = "127.0.0.1", PlayerPort = 44370
            };

            services.AddSingleton(conf);
            services.AddSingleton(MockGenerator.Get <Serilog.ILogger>());

            services.AddSingleton(manager);

            ServiceShareContainer shareContainer = new ServiceShareContainer
            {
                GameStarted     = false,
                ConfirmedAgents = new Dictionary <int, bool>(),
                GMClient        = gmClient
            };

            services.AddSingleton(shareContainer);

            services.AddSingleton(Mock.Of <IApplicationLifetime>());
            services.AddSingleton(new ServiceSynchronization(2, 2));

            services.AddHostedService <CommunicationService>();

            return(services);
        }
 public CommunicationService(ISocketManager <ISocketClient <Message, Message>, Message> manager,
                             ServiceShareContainer container, BufferBlock <Message> queue, ILogger log, ServiceSynchronization sync)
 {
     this.manager   = manager;
     this.queue     = queue;
     this.container = container;
     this.logger    = log.ForContext <CommunicationService>();
     this.sync      = sync;
 }
 public GMTcpSocketService(BufferBlock <Message> queue, ServiceShareContainer container,
                           ServerConfiguration conf, IApplicationLifetime lifetime, ILogger log, Shared.ServiceSynchronization sync)
     : base(log.ForContext <GMTcpSocketService>())
 {
     this.queue     = queue;
     this.container = container;
     this.conf      = conf;
     this.lifetime  = lifetime;
     this.log       = log;
     this.sync      = sync;
 }
 public PlayersTcpSocketService(ISocketManager <ISocketClient <Message, Message>, Message> manager,
                                BufferBlock <Message> queue, ServiceShareContainer container, ServerConfiguration conf, ILogger log,
                                ServiceSynchronization sync)
     : base(log.ForContext <PlayersTcpSocketService>())
 {
     this.manager   = manager;
     this.queue     = queue;
     this.container = container;
     this.conf      = conf;
     this.log       = log;
     this.sync      = sync;
 }