mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-27 21:24:12 -04:00
Don't use records for spec classes
This commit is contained in:
parent
70edc8989c
commit
356b1a6afd
18 changed files with 179 additions and 61 deletions
|
@ -3,7 +3,6 @@
|
|||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<NoWarn>$(NoWarn);xUnit1013</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -6,13 +6,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.CsvWriting;
|
||||
|
||||
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class ContentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public ContentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_are_exported_correctly()
|
||||
{
|
||||
// Act
|
||||
var document = await ExportWrapper.ExportAsCsvAsync(ChannelIds.DateRangeTestCases);
|
||||
var document = await _exportWrapper.ExportAsCsvAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
document.Should().ContainAll(
|
||||
|
|
|
@ -15,14 +15,21 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs;
|
||||
|
||||
public record DateRangeSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
|
||||
public class DateRangeSpecs : IClassFixture<TempOutputFixture>
|
||||
{
|
||||
private readonly TempOutputFixture _tempOutput;
|
||||
|
||||
public DateRangeSpecs(TempOutputFixture tempOutput)
|
||||
{
|
||||
_tempOutput = tempOutput;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_filtered_after_specific_date_only_include_messages_sent_after_that_date()
|
||||
{
|
||||
// Arrange
|
||||
var after = new DateTimeOffset(2021, 07, 24, 0, 0, 0, TimeSpan.Zero);
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -68,7 +75,7 @@ public record DateRangeSpecs(TempOutputFixture TempOutput) : IClassFixture<TempO
|
|||
{
|
||||
// Arrange
|
||||
var before = new DateTimeOffset(2021, 07, 24, 0, 0, 0, TimeSpan.Zero);
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -113,7 +120,7 @@ public record DateRangeSpecs(TempOutputFixture TempOutput) : IClassFixture<TempO
|
|||
// Arrange
|
||||
var after = new DateTimeOffset(2021, 07, 24, 0, 0, 0, TimeSpan.Zero);
|
||||
var before = new DateTimeOffset(2021, 08, 01, 0, 0, 0, TimeSpan.Zero);
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
|
|
@ -14,13 +14,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs;
|
||||
|
||||
public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
|
||||
public class FilterSpecs : IClassFixture<TempOutputFixture>
|
||||
{
|
||||
private readonly TempOutputFixture _tempOutput;
|
||||
|
||||
public FilterSpecs(TempOutputFixture tempOutput)
|
||||
{
|
||||
_tempOutput = tempOutput;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_filtered_by_text_only_include_messages_that_contain_that_text()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -48,7 +55,7 @@ public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutp
|
|||
public async Task Messages_filtered_by_author_only_include_messages_sent_by_that_author()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -76,7 +83,7 @@ public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutp
|
|||
public async Task Messages_filtered_by_content_only_include_messages_that_have_that_content()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -104,7 +111,7 @@ public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutp
|
|||
public async Task Messages_filtered_by_pin_only_include_messages_that_have_been_pinned()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
@ -132,7 +139,7 @@ public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutp
|
|||
public async Task Messages_filtered_by_mention_only_include_messages_that_have_that_mention()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
|
||||
// Act
|
||||
await new ExportChannelsCommand
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class AttachmentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public AttachmentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_a_generic_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885587844989612074")
|
||||
);
|
||||
|
@ -37,7 +44,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_an_image_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885654862656843786")
|
||||
);
|
||||
|
@ -56,7 +63,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_a_video_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885655761919836171")
|
||||
);
|
||||
|
@ -75,7 +82,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_an_audio_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885656175620808734")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class ContentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public ContentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_are_exported_correctly()
|
||||
{
|
||||
// Act
|
||||
var messages = await ExportWrapper.GetMessagesAsHtmlAsync(ChannelIds.DateRangeTestCases);
|
||||
var messages = await _exportWrapper.GetMessagesAsHtmlAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
messages.Select(e => e.GetAttribute("data-message-id")).Should().Equal(
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public EmbedSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_an_embed_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.EmbedTestCases,
|
||||
Snowflake.Parse("866769910729146400")
|
||||
);
|
||||
|
@ -35,7 +42,7 @@ public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<Exp
|
|||
public async Task Message_with_a_link_to_an_image_is_rendered_with_that_image()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.EmbedTestCases,
|
||||
Snowflake.Parse("991758772349440053")
|
||||
);
|
||||
|
@ -50,7 +57,7 @@ public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<Exp
|
|||
public async Task Message_with_a_Spotify_track_is_rendered_using_an_iframe()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.EmbedTestCases,
|
||||
Snowflake.Parse("867886632203976775")
|
||||
);
|
||||
|
@ -65,7 +72,7 @@ public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<Exp
|
|||
public async Task Message_with_a_YouTube_video_is_rendered_using_an_iframe()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.EmbedTestCases,
|
||||
Snowflake.Parse("866472508588294165")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class MentionSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public MentionSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task User_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866458840245076028")
|
||||
);
|
||||
|
@ -28,7 +35,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Text_channel_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459040480624680")
|
||||
);
|
||||
|
@ -41,7 +48,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Voice_channel_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459175462633503")
|
||||
);
|
||||
|
@ -54,7 +61,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Role_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459254693429258")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record ReplySpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class ReplySpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public ReplySpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Reply_to_a_normal_message_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.ReplyTestCases,
|
||||
Snowflake.Parse("866460738239725598")
|
||||
);
|
||||
|
@ -28,7 +35,7 @@ public record ReplySpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<Exp
|
|||
public async Task Reply_to_a_deleted_message_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.ReplyTestCases,
|
||||
Snowflake.Parse("866460975388819486")
|
||||
);
|
||||
|
@ -43,7 +50,7 @@ public record ReplySpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<Exp
|
|||
public async Task Reply_to_an_empty_message_with_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.ReplyTestCases,
|
||||
Snowflake.Parse("866462470335627294")
|
||||
);
|
||||
|
|
|
@ -7,13 +7,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
|
||||
|
||||
public record StickerSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class StickerSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public StickerSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_a_PNG_based_sticker_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.StickerTestCases,
|
||||
Snowflake.Parse("939670623158943754")
|
||||
);
|
||||
|
@ -30,7 +37,7 @@ public record StickerSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Message_with_a_Lottie_based_sticker_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
var message = await _exportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.StickerTestCases,
|
||||
Snowflake.Parse("939670526517997590")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
|
||||
|
||||
public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class AttachmentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public AttachmentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_a_generic_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885587844989612074")
|
||||
);
|
||||
|
@ -36,7 +43,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_an_image_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885654862656843786")
|
||||
);
|
||||
|
@ -58,7 +65,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_a_video_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885655761919836171")
|
||||
);
|
||||
|
@ -80,7 +87,7 @@ public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixtur
|
|||
public async Task Message_with_an_audio_attachment_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.AttachmentTestCases,
|
||||
Snowflake.Parse("885656175620808734")
|
||||
);
|
||||
|
|
|
@ -7,13 +7,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
|
||||
|
||||
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class ContentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public ContentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_are_exported_correctly()
|
||||
{
|
||||
// Act
|
||||
var messages = await ExportWrapper.GetMessagesAsJsonAsync(ChannelIds.DateRangeTestCases);
|
||||
var messages = await _exportWrapper.GetMessagesAsJsonAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
messages.Select(j => j.GetProperty("id").GetString()).Should().Equal(
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
|
||||
|
||||
public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public EmbedSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_an_embed_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.EmbedTestCases,
|
||||
Snowflake.Parse("866769910729146400")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
|
||||
|
||||
public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class MentionSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public MentionSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task User_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866458840245076028")
|
||||
);
|
||||
|
@ -33,7 +40,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Text_channel_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459040480624680")
|
||||
);
|
||||
|
@ -46,7 +53,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Voice_channel_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459175462633503")
|
||||
);
|
||||
|
@ -59,7 +66,7 @@ public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Role_mention_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("866459254693429258")
|
||||
);
|
||||
|
|
|
@ -8,13 +8,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
|
||||
|
||||
public record StickerSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class StickerSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public StickerSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Message_with_a_PNG_based_sticker_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.StickerTestCases,
|
||||
Snowflake.Parse("939670623158943754")
|
||||
);
|
||||
|
@ -35,7 +42,7 @@ public record StickerSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<E
|
|||
public async Task Message_with_a_Lottie_based_sticker_is_rendered_correctly()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
var message = await _exportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.StickerTestCases,
|
||||
Snowflake.Parse("939670526517997590")
|
||||
);
|
||||
|
|
|
@ -12,13 +12,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs;
|
||||
|
||||
public record PartitioningSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
|
||||
public class PartitioningSpecs : IClassFixture<TempOutputFixture>
|
||||
{
|
||||
private readonly TempOutputFixture _tempOutput;
|
||||
|
||||
public PartitioningSpecs(TempOutputFixture tempOutput)
|
||||
{
|
||||
_tempOutput = tempOutput;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_partitioned_by_count_are_split_into_multiple_files_correctly()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
var fileNameWithoutExt = Path.GetFileNameWithoutExtension(filePath);
|
||||
var dirPath = Path.GetDirectoryName(filePath) ?? Directory.GetCurrentDirectory();
|
||||
|
||||
|
@ -42,7 +49,7 @@ public record PartitioningSpecs(TempOutputFixture TempOutput) : IClassFixture<Te
|
|||
public async Task Messages_partitioned_by_file_size_are_split_into_multiple_files_correctly()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
var fileNameWithoutExt = Path.GetFileNameWithoutExtension(filePath);
|
||||
var dirPath = Path.GetDirectoryName(filePath) ?? Directory.GetCurrentDirectory();
|
||||
|
||||
|
|
|
@ -6,13 +6,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.PlainTextWriting;
|
||||
|
||||
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public class ContentSpecs : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
private readonly ExportWrapperFixture _exportWrapper;
|
||||
|
||||
public ContentSpecs(ExportWrapperFixture exportWrapper)
|
||||
{
|
||||
_exportWrapper = exportWrapper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_are_exported_correctly()
|
||||
{
|
||||
// Act
|
||||
var document = await ExportWrapper.ExportAsPlainTextAsync(ChannelIds.DateRangeTestCases);
|
||||
var document = await _exportWrapper.ExportAsPlainTextAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
document.Should().ContainAll(
|
||||
|
|
|
@ -13,13 +13,20 @@ using Xunit;
|
|||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs;
|
||||
|
||||
public record SelfContainedSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
|
||||
public class SelfContainedSpecs : IClassFixture<TempOutputFixture>
|
||||
{
|
||||
private readonly TempOutputFixture _tempOutput;
|
||||
|
||||
public SelfContainedSpecs(TempOutputFixture tempOutput)
|
||||
{
|
||||
_tempOutput = tempOutput;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Messages_in_self_contained_export_only_reference_local_file_resources()
|
||||
{
|
||||
// Arrange
|
||||
var filePath = TempOutput.GetTempFilePath();
|
||||
var filePath = _tempOutput.GetTempFilePath();
|
||||
var dirPath = Path.GetDirectoryName(filePath) ?? Directory.GetCurrentDirectory();
|
||||
|
||||
// Act
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue