Преглед изворни кода

Fixed Test_Document_Paragraphs

Also moved the documents directory to a proper temprorary path.
master
Jan Bernlöhr пре 9 година
родитељ
комит
389212e1fa
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5
    5
      UnitTests/DocXUnitTests.cs

+ 5
- 5
UnitTests/DocXUnitTests.cs Прегледај датотеку

{ {
private readonly string _directoryDocuments; private readonly string _directoryDocuments;
private const string FileTemp = "temp.docx";
private readonly string _directoryWithFiles; private readonly string _directoryWithFiles;
private static Border BlankBorder = new Border(BorderStyle.Tcbs_none, 0, 0, Color.White); private static Border BlankBorder = new Border(BorderStyle.Tcbs_none, 0, 0, Color.White);
public DocXUnitTests() public DocXUnitTests()
{ {
_directoryDocuments = Path.Combine((new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory)).Parent.FullName, "documents");
_directoryDocuments = Path.Combine(Path.GetTempPath(), "DocXTests", "documents");
Setup(_directoryDocuments); // prepare temp documents directory Setup(_directoryDocuments); // prepare temp documents directory
_directoryWithFiles = TestHelper.DirectoryWithFiles; _directoryWithFiles = TestHelper.DirectoryWithFiles;
[Test] [Test]
public void Test_Document_Paragraphs() public void Test_Document_Paragraphs()
{ {
string temporaryFilePath = Path.Combine(_directoryDocuments, "temp.docx");
// Load the document 'Paragraphs.docx' // Load the document 'Paragraphs.docx'
using (DocX document = DocX.Load(Path.Combine(_directoryWithFiles, "Paragraphs.docx"))) using (DocX document = DocX.Load(Path.Combine(_directoryWithFiles, "Paragraphs.docx")))
{ {
Assert.IsTrue(paragraph.PackagePart.Uri.ToString() == package_part_document); Assert.IsTrue(paragraph.PackagePart.Uri.ToString() == package_part_document);
} }
// Test the saving of the document. // Test the saving of the document.
document.SaveAs(FileTemp);
document.SaveAs(temporaryFilePath);
} }
// Delete the tempory file. // Delete the tempory file.
File.Delete(FileTemp);
File.Delete(temporaryFilePath);
} }
[Test] [Test]

Loading…
Откажи
Сачувај