public async Task Connect_SetsIdAndName() { _rtm.Connect().Returns(new ConnectResponse { Self = new Self { Id = "foo", Name = "bar" } }); await _sut.Connect(); _sut.Id.ShouldBe("foo"); _sut.Name.ShouldBe("bar"); }
private static async Task Run(string token) { using (var bot = new SlackBot(token)) { bot.AddHandler(new PingHandler()); await bot.Connect().ConfigureAwait(false); Console.WriteLine("Connected"); await WaitForKeyPress().ConfigureAwait(false); } }
private void Connect() { if (!_connected) { lock (_connectLock) { if (!_connected) { _bot = SlackBot.Connect(_token).Result; _bot.RegisterHandler(this); _connected = true; OnConnected(); } } } }
private static async Task Run(string[] args) { string token = args[0]; string logfile = args[1]; string aikey = args[2]; string aiend = args[3]; using (var bot = new SlackBot(token)){ bot.AddHandler(new PingHandler()); //bot.AddHandler(new MessageHandler()); bot.AddHandler(new MessageHandler(logfile)); bot.AddHandler(new AnalyticsHandler(aikey, aiend)); await bot.Connect().ConfigureAwait(false); Console.WriteLine("Connected"); await WaitForKeyPress().ConfigureAwait(false); } }