public void Creates_Appropriate_Message(StaticMessage message) { var creator = new StaticMessageCreator(); var bytes = creator.CreateMessage(message); Assert.AreEqual(bytes, message.Bytes); }
public async Task Gets_content_and_says_it_to_chat_room() { // arrange var channel = "somechannel" + Guid.NewGuid(); var commandName = "!somemessage"; var expectedContent = "blah blah blah whatever " + Guid.NewGuid(); var content = new ValidStaticCommands { Commands = new List <StaticCommandInfo> { new StaticCommandInfo { Command = commandName, Content = expectedContent } } }; _mockBucket.Setup(x => x.GetAsync <ValidStaticCommands>("staticContentCommands")) .ReturnsAsync(new FakeOperationResult <ValidStaticCommands> { Value = content }); var request = new StaticMessage(commandName, channel); // act await _handler.Handle(request, CancellationToken.None); // assert // _twitchClient.SendMessage(request.Channel, command.Content); _mockTwitchClient.Verify(x => x.SendMessage(channel, expectedContent, false), Times.Once); }
/// <summary> /// Sends the message. /// </summary> /// <param name="type">The type.</param> internal void SendMessage(StaticMessage type) { if (GetConnection() == null) { return; } GetConnection().SendData(StaticMessagesManager.Get(type)); }
/// <summary> /// Sends the message. /// </summary> /// <param name="type">The type.</param> internal void SendMessage(StaticMessage type) { if (GetConnection() == null) return; GetConnection().SendData(StaticMessagesManager.Get(type)); }
/// <summary> /// Gets the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns>System.Byte[].</returns> public static byte[] Get(StaticMessage type) { return Cache[type]; }
/// <summary> /// Gets the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns>System.Byte[].</returns> public static byte[] Get(StaticMessage type) { return(Cache[type]); }