47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using Core.Entities;
|
|
using Tests.Builders;
|
|
|
|
namespace Tests.Parsers;
|
|
|
|
/// <summary>
|
|
/// Shared helper methods for EventOccurrenceParser tests.
|
|
/// </summary>
|
|
public static class EventOccurrenceParserTestHelpers
|
|
{
|
|
/// <summary>
|
|
/// Creates a temporary file with the specified content and returns the FileInfo.
|
|
/// </summary>
|
|
public static FileInfo CreateTempFile(string content)
|
|
{
|
|
var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".txt");
|
|
File.WriteAllText(tempPath, content);
|
|
return new FileInfo(tempPath);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a minimal EventDefinition for testing.
|
|
/// </summary>
|
|
public static EventDefinition CreateTestEvent(string name)
|
|
{
|
|
return EventDefinitionBuilder.Individual(name).Build();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cleans up a temporary file.
|
|
/// </summary>
|
|
public static void CleanupTempFile(FileInfo file)
|
|
{
|
|
try
|
|
{
|
|
if (file.Exists)
|
|
File.Delete(file.FullName);
|
|
}
|
|
catch
|
|
{
|
|
// Ignore cleanup errors
|
|
}
|
|
}
|
|
}
|
|
|
|
|