aboutsummaryrefslogtreecommitdiff
path: root/RhSolutions.SkuParser.Tests/FormFileUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'RhSolutions.SkuParser.Tests/FormFileUtil.cs')
-rw-r--r--RhSolutions.SkuParser.Tests/FormFileUtil.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/RhSolutions.SkuParser.Tests/FormFileUtil.cs b/RhSolutions.SkuParser.Tests/FormFileUtil.cs
new file mode 100644
index 0000000..aaee7ca
--- /dev/null
+++ b/RhSolutions.SkuParser.Tests/FormFileUtil.cs
@@ -0,0 +1,17 @@
+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;
+ }
+} \ No newline at end of file