Get rid of xUnit fixtures

This commit is contained in:
Tyrrrz
2023-02-11 23:12:15 +02:00
parent 3487849eba
commit 53b8927fce
29 changed files with 221 additions and 347 deletions

View File

@@ -3,7 +3,6 @@ using System.Linq;
using System.Threading.Tasks;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands;
using DiscordChatExporter.Cli.Tests.Fixtures;
using DiscordChatExporter.Cli.Tests.Infra;
using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Cli.Tests.Utils;
@@ -13,22 +12,14 @@ using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs;
[Collection(nameof(ExportWrapperCollection))]
public class SelfContainedSpecs : IClassFixture<TempOutputFixture>
public class SelfContainedSpecs
{
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 dirPath = Path.GetDirectoryName(filePath) ?? Directory.GetCurrentDirectory();
using var dir = TempDir.Create();
var filePath = Path.Combine(dir.Path, "output.html");
// Act
await new ExportChannelsCommand
@@ -45,7 +36,7 @@ public class SelfContainedSpecs : IClassFixture<TempOutputFixture>
.Parse(await File.ReadAllTextAsync(filePath))
.QuerySelectorAll("body [src]")
.Select(e => e.GetAttribute("src")!)
.Select(f => Path.GetFullPath(f, dirPath))
.Select(f => Path.GetFullPath(f, dir.Path))
.All(File.Exists)
.Should()
.BeTrue();