예제 #1
0
        static IMessageManager CreateMessageManager()
        {
            var manager = new MessageManager();

            manager.AddCase(new SimpleRespondCase("Привет", (c, m) => $"Привет, {c.Name}!"));
            manager.AddCase(new SimpleRespondCase("Как дела?", (c, m) => $"Отлично!"));
            manager.AddCase(new SimpleRespondCase("Сколько времени?", (c, m) => $"Время {DateTime.Now.ToShortTimeString()}"));
            manager.AddCase(new SimpleRespondCase("Покажи всех клиентов",
                                                  (c, m) => String.Join('\n', manager.Clients.Select(c => $"[{c.Id}] {c.Name}"))));
            manager.AddCase(new RandomRespondCase());
            return(manager);
        }