public void WriteSomeMessagesToSomeChats() { Assert.IsTrue(_skype.Write(PrivateChatTitle, "Hello 1"), "Error while sending first private message"); Assert.IsTrue(_skype.Write(PublicChatTitle, "Hello 2"), "Error while sending first public chat message"); Assert.IsTrue(_skype.Write(PublicChatTitle, "Hello 3"), "Error while sending second public chat message"); Assert.IsTrue(_skype.Write(PrivateChatTitle, "Hello 4"), "Error while sending second private message"); }
public Task SendAsync(Destination destination, BotResponse botResponse, SkypeSender skypeSender = null) { if (_isMocked) { Console.WriteLine($"{destination.Messenger.ToString()}, {destination.ChannelId}, {destination.UserId}: {botResponse.Text}"); Console.WriteLine("-------------------------------------------------------"); return(Task.CompletedTask); } switch (destination.Messenger) { case Messenger.Slack: return(_slackClient.PostMessageAsync(destination.ChannelId, botResponse.Text)); case Messenger.Telegram: return(_telegramClient != null?_telegramClient.SendTextMessageAsync(destination.ChannelId, botResponse.Text) : Task.CompletedTask); case Messenger.Skype: if (skypeSender == null) { // todo: log warning: skypeSender is null return(Task.CompletedTask); } return(Task.Run(() => skypeSender.Write(destination.ChannelId, botResponse.Text))); default: // todo: log warning: unsupported messenger return(Task.CompletedTask); } }