public async Task Messages_filtered_by_content_only_include_messages_that_have_that_content() { // Arrange var filePath = _tempOutput.GetTempFilePath(); // Act await new ExportChannelsCommand { Token = Secrets.DiscordToken, ChannelIds = new[] { ChannelIds.FilterTestCases }, ExportFormat = ExportFormat.Json, OutputPath = filePath, MessageFilter = MessageFilter.Parse("has:image") }.ExecuteAsync(new FakeConsole()); // Assert Json .Parse(await File.ReadAllTextAsync(filePath)) .GetProperty("messages") .EnumerateArray() .Select(j => j.GetProperty("content").GetString()) .Should() .ContainSingle("This has image"); }
public async Task Messages_filtered_by_author_only_include_messages_sent_by_that_author() { // Arrange var filePath = _tempOutput.GetTempFilePath(); // Act await new ExportChannelsCommand { Token = Secrets.DiscordToken, ChannelIds = new[] { ChannelIds.FilterTestCases }, ExportFormat = ExportFormat.Json, OutputPath = filePath, MessageFilter = MessageFilter.Parse("from:Tyrrrz") }.ExecuteAsync(new FakeConsole()); // Assert Json .Parse(await File.ReadAllTextAsync(filePath)) .GetProperty("messages") .EnumerateArray() .Select(j => j.GetProperty("author").GetProperty("name").GetString()) .Should() .AllBe("Tyrrrz"); }