mirror of
https://github.com/Ikatono/ComiServ.git
synced 2025-10-28 20:45:35 -05:00
Added first controller unit test as well as several mock services
This commit is contained in:
@@ -313,6 +313,8 @@ public class ComicController(ComicsContext context, ILogger<ComicController> log
|
||||
var comic = await _context.Comics.SingleOrDefaultAsync(c => c.Handle == handle);
|
||||
if (comic is null)
|
||||
return NotFound(RequestError.ComicNotFound);
|
||||
//can't mock this easily, move to a service?
|
||||
//maybe IComicAnalyzer should be used even just to read a file
|
||||
var data = await System.IO.File.ReadAllBytesAsync(Path.Join(_config.LibraryRoot, comic.Filepath));
|
||||
return File(data, "application/octet-stream", new FileInfo(comic.Filepath).Name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user