
3 changed files with 18 additions and 69 deletions
-
2build.sln
-
34tests/Datory.Tests/Utils/TranslateUtils.cs
-
51tests/SSCMS.Core.Tests/Common/Office/WordManagerTests.cs
@ -1,51 +0,0 @@ |
|||
using System.IO; |
|||
using SSCMS.Tests; |
|||
using SSCMS.Core.Utils.Office; |
|||
using SSCMS.Utils; |
|||
using Xunit; |
|||
|
|||
namespace SSCMS.Core.Tests.Common.Office |
|||
{ |
|||
public class WordManagerTests : IClassFixture<UnitTestsFixture> |
|||
{ |
|||
private readonly UnitTestsFixture _fixture; |
|||
|
|||
public WordManagerTests(UnitTestsFixture fixture) |
|||
{ |
|||
_fixture = fixture; |
|||
} |
|||
|
|||
[Fact] |
|||
public void WordParseTest() |
|||
{ |
|||
var projDirectoryPath = _fixture.SettingsManager.ContentRootPath; |
|||
|
|||
var htmlDirectoryPath = PathUtils.Combine(projDirectoryPath, "build"); |
|||
var imageDirectoryPath = PathUtils.Combine(htmlDirectoryPath, "images"); |
|||
const string imageDirectoryUrl = "images"; |
|||
DirectoryUtils.DeleteDirectoryIfExists(htmlDirectoryPath); |
|||
DirectoryUtils.CreateDirectoryIfNotExists(htmlDirectoryPath); |
|||
|
|||
var wordsDirectory = PathUtils.Combine(projDirectoryPath, "assets/words"); |
|||
|
|||
foreach (var docxFilePath in Directory.GetFiles(wordsDirectory, "*.docx")) |
|||
{ |
|||
var settings = new WordManager.ConverterSettings |
|||
{ |
|||
IsSaveHtml = true, |
|||
HtmlDirectoryPath = htmlDirectoryPath, |
|||
ImageDirectoryPath = imageDirectoryPath, |
|||
ImageDirectoryUrl = imageDirectoryUrl |
|||
}; |
|||
|
|||
WordManager.ConvertToHtml(docxFilePath, settings); |
|||
} |
|||
foreach (var file in Directory.GetFiles(htmlDirectoryPath, "*.html")) |
|||
{ |
|||
WordManager.ConvertToDocx(file, htmlDirectoryPath); |
|||
} |
|||
|
|||
Assert.True(true); |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue