mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 06:03:12 +00:00
28 lines
720 B
C#
28 lines
720 B
C#
using Microsoft.AspNetCore.Http;
|
|
using SeaHaven.Services.Interfaces;
|
|
|
|
namespace SeaHavenIndustries.Tests;
|
|
|
|
internal sealed class TestFileStoragePort : IFileStoragePort
|
|
{
|
|
private readonly Func<string, Stream?> _openRead;
|
|
|
|
public TestFileStoragePort(Func<string, Stream?>? openRead = null)
|
|
{
|
|
_openRead = openRead ?? (_ => null);
|
|
}
|
|
|
|
public int TryDeleteCalls { get; private set; }
|
|
|
|
public Task<string> SaveFileAsync(IFormFile file)
|
|
=> Task.FromResult("https://example.test/Assets/Documents/saved.bin");
|
|
|
|
public bool TryDelete(string fileUrl)
|
|
{
|
|
TryDeleteCalls++;
|
|
return true;
|
|
}
|
|
|
|
public Stream? OpenRead(string fileUrl)
|
|
=> _openRead(fileUrl);
|
|
}
|