26 lines
847 B
C#
26 lines
847 B
C#
using MeetTheTeacher.Model;
|
|
|
|
namespace MeetTheTeacher.Test.Export;
|
|
|
|
public abstract class ExporterTestBase
|
|
{
|
|
protected static string FileName => "testFile";
|
|
protected string FilePath => Path.Combine(Directory.GetCurrentDirectory(), $"{FileName}.{FileExtension}");
|
|
protected abstract string FileExtension { get; }
|
|
|
|
protected static IEnumerable<ICsvRepresentable> SampleData =>
|
|
new List<ICsvRepresentable>
|
|
{
|
|
new TestData { Name = "John", Age = 30 },
|
|
new TestData { Name = "Jane", Age = 25 }
|
|
};
|
|
|
|
protected class TestData : ICsvRepresentable
|
|
{
|
|
public required string Name { get; init; }
|
|
public int Age { get; init; }
|
|
|
|
public CsvData ToCsvData() =>
|
|
new(new List<string> { "Name", "Age" }, new List<string> { Name, Age.ToString() });
|
|
}
|
|
}
|