Don't use records for spec classes

This commit is contained in:
Oleksii Holub
2022-06-29 20:49:51 +03:00
parent 70edc8989c
commit 356b1a6afd
18 changed files with 179 additions and 61 deletions

View File

@@ -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")
);

View File

@@ -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(

View File

@@ -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")
);

View File

@@ -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")
);

View File

@@ -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")
);