ResolveTest.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.IO;
  3. using Newtonsoft.Json;
  4. using QuestionSwapDoc;
  5. using QuestionSwapDoc.SwapQuestionModel;
  6. using Xunit;
  7. namespace YGNT.Exam.Tests.Question
  8. {
  9. public class ResolveTest
  10. {
  11. private string filePath = @"C:\Eaxm\aspnet-core\src\YGNT.Exam.Web.Host\wwwroot\Files\2021-三月-22\h05lhan0.p1h";
  12. [Fact]
  13. public void Resolve()
  14. {
  15. var fileName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
  16. var resolvePath = Path.Combine(AppContext.BaseDirectory, "Question", "Resolve", fileName);
  17. var imgPath = Path.Combine(resolvePath, "img");
  18. var question = SwapQuestion.GetQue(filePath,
  19. resolvePath,
  20. imgPath,
  21. Path.GetRelativePath(AppContext.BaseDirectory, imgPath),
  22. new QueTypeString()
  23. {
  24. XuanZheStrings = new[] { "选择题" }
  25. });
  26. var json = JsonConvert.SerializeObject(question);
  27. }
  28. }
  29. }