Ejemplo n.º 1
0
        public void Setup()
        {
            Configuration           = Mock.Of <IConfiguration>();
            CancellationTokenSource = new CancellationTokenSource();
            Clients      = new Dictionary <string, ChatClient>();
            LastMessages = new Dictionary <string, List <string> >();
            InjectionConfig.ConfigureServices(Configuration);
            ChatApplication = InjectionConfig.Get <ChatApplication>();

            Task.Run(async() =>
            {
                await ChatApplication.StartAsync(CancellationTokenSource.Token);
            });
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            IConfiguration configuration = CreateConfiguration(args);

            InjectionConfig.ConfigureServices(configuration);

            InjectionConfig.Get <ICommunicator <string> >().OnClientConnected    += Communicator_OnClientConnected;
            InjectionConfig.Get <ICommunicator <string> >().OnClientDisconnected += Communicator_OnClientDisconnected;
            InjectionConfig.Get <ICommunicator <string> >().OnClientSendCommand  += Communicator_OnClientSendCommand;

            Console.WriteLine($"Starting Chat Server...");

            await InjectionConfig.Get <ChatApplication>().StartAsync();
        }