17 lines
472 B
C#
17 lines
472 B
C#
using Microsoft.AspNetCore.Http;
|
|
using Moq;
|
|
|
|
namespace RhSolutions.SkuParser.Tests;
|
|
|
|
public static class FormFileUtil
|
|
{
|
|
public static Mock<IFormFile> GetMockFormFile(string workbookName)
|
|
{
|
|
string filepath = "./../../../Workbooks/" + workbookName;
|
|
var mockFile = new Mock<IFormFile>();
|
|
var memoryStream = new MemoryStream([.. File.ReadAllBytes(filepath)]);
|
|
mockFile.Setup(x => x.OpenReadStream())
|
|
.Returns(memoryStream);
|
|
return mockFile;
|
|
}
|
|
} |