public async Task If_no_current_project_set_show_default_message() { // arrange var expectedDefaultMessage = "I haven't set any current project yet, sorry!"; var twitchLibMessage = TwitchLibMessageBuilder.Create() .WithUsername("doesntmatterusername") .Build(); var chatMessage = ChatMessageBuilder.Create() .WithTwitchLibMessage(twitchLibMessage) .WithMessage("!currentproject") .WithChannel("doesntmatterchannel") .Build(); var request = new SayCurrentProject(chatMessage); _mockBucket.Setup(x => x.Get <CurrentProjectInfo>("currentProject")) .Returns(new FakeOperationResult <CurrentProjectInfo> { Success = false }); // act await _handler.Handle(request, CancellationToken.None); // assert _mockTwitchClient.Verify(x => x.SendMessage(It.IsAny <string>(), expectedDefaultMessage, false), Times.Once); }
public async Task If_no_current_project_set_show_default_message() { // arrange var expectedDefaultMessage = "I haven't set any current project yet, sorry!"; var twitchLibMessage = TwitchLibMessageBuilder.Create() .WithUsername("doesntmatterusername") .Build(); var chatMessage = ChatMessageBuilder.Create() .WithTwitchLibMessage(twitchLibMessage) .WithMessage("!currentproject") .WithChannel("doesntmatterchannel") .Build(); var request = new SayCurrentProject(chatMessage); MockCollection.Setup(m => m.GetAsync("currentProject", null)) .Throws <Exception>(); // act await _handler.Handle(request, CancellationToken.None); // assert MockTwitchClient.Verify(x => x.SendMessage(It.IsAny <string>(), expectedDefaultMessage, false), Times.Once); }