Adding unit tests, refactoring file access to a service, adding CatalogImageMissingException.

This commit is contained in:
Steve Smith committed 2017-04-28 19:56:32 -04:00
1 parent ac89e73bf4
commit 5dbbc4c791
10 files changed
+157 -14

No files matched your search

@@ -0,0 +1,22 @@
using ApplicationCore.Interfaces;
using Microsoft.AspNetCore.Hosting;
using System.IO;
namespace Infrastructure.FileSystem
{
public class LocalFileImageService : IImageService
{
private readonly IHostingEnvironment _env;
public LocalFileImageService(IHostingEnvironment env)
{
_env = env;
}
public byte[] GetImageBytesById(int id)
{
var contentRoot = _env.ContentRootPath + "//Pics";
var path = Path.Combine(contentRoot, id + ".png");
return File.ReadAllBytes(path);
}
}
}