public async void PollHandlerRejectsOnlyOneOption() { var commandQ = new MockCommandQueue(); var dataSource = new MockDataSource(); var repo = dataSource.Repository<User>() as MockRepository<User>; repo.ObjectCache.Add("ballouthebear", new User() { Channels = new Dictionary<string, UserChannel>() { { "#ballouthebear", new UserChannel() { IsModerator = true } } } }); var rawMessage = "@color=#FF0000;display-name=BallouTheBear;emotes=;subscriber=0;turbo=0;user-id=30514348;user-type= :[email protected] PRIVMSG #ballouthebear :!poll \"Do you like big butts?\";\"Yes\""; var message = MessageParser.ParseIrcMessage(rawMessage); var pollHandler = new PollHandler(commandQ, dataSource, new MockLogger()); await pollHandler.ReceiveMessage(message); var result = commandQ.DequeueCommand(); Assert.NotNull(result); Assert.NotEqual("", result); Assert.Contains("You must have at least two options!", result); }
public async void PollHandlerCanCreateAndPostPoll() { PluginStore.InitializePluginStoreNew(builder => new AssemblyCatalog(GetType().Assembly, builder)); var commandQ = new MockCommandQueue(); var dataSource = new MockDataSource(); var repo = dataSource.Repository<User>() as MockRepository<User>; repo.ObjectCache.Add("ballouthebear", new User() { Channels = new Dictionary<string, UserChannel>() { { "#ballouthebear", new UserChannel() { IsModerator = true } } } }); var rawMessage = "@color=#FF0000;display-name=BallouTheBear;emotes=;subscriber=0;turbo=0;user-id=30514348;user-type= :[email protected] PRIVMSG #ballouthebear :!poll \"Do you like big butts?\";\"Yes\";\"No\""; var message = MessageParser.ParseIrcMessage(rawMessage); var pollHandler = new PollHandler(commandQ, dataSource, new MockLogger()); await pollHandler.ReceiveMessage(message); var result = commandQ.DequeueCommand(); Assert.NotNull(result); Assert.NotEqual("", result); Assert.Contains("Do you like big butts?", result); }