-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from DomCR/issue-63_slow-dwg-reader
Issue 63 Slow Read
- Loading branch information
Showing
4 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using ACadSharp.IO; | ||
using System.IO; | ||
using System.Linq; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ACadSharp.Tests.IO | ||
{ | ||
public class StressSamplesReader : IOTestsBase | ||
{ | ||
public static TheoryData<string> UserDwgFilePaths { get; } | ||
|
||
public static TheoryData<string> UserDxfFiles { get; } | ||
|
||
static StressSamplesReader() | ||
{ | ||
string path = Path.Combine(_samplesFolder, "local", "stress"); | ||
UserDwgFilePaths = new TheoryData<string>(); | ||
UserDxfFiles = new TheoryData<string>(); | ||
|
||
if (!Directory.Exists(path)) | ||
{ | ||
UserDwgFilePaths.Add(string.Empty); | ||
UserDxfFiles.Add(string.Empty); | ||
return; | ||
} | ||
|
||
foreach (string file in Directory.GetFiles(path, $"*.dwg")) | ||
{ | ||
UserDwgFilePaths.Add(file); | ||
} | ||
|
||
foreach (string file in Directory.GetFiles(path, $"*.dxf")) | ||
{ | ||
UserDxfFiles.Add(file); | ||
} | ||
|
||
if (!UserDwgFilePaths.Any()) | ||
{ | ||
UserDwgFilePaths.Add(string.Empty); | ||
} | ||
|
||
if (!UserDxfFiles.Any()) | ||
{ | ||
UserDxfFiles.Add(string.Empty); | ||
} | ||
} | ||
|
||
public StressSamplesReader(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(UserDwgFilePaths))] | ||
public void ReadUserDwg(string test) | ||
{ | ||
if (string.IsNullOrEmpty(test)) | ||
return; | ||
|
||
CadDocument doc = DwgReader.Read(test, this.onNotification); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(UserDxfFiles))] | ||
public void ReadUserDxf(string test) | ||
{ | ||
if (string.IsNullOrEmpty(test)) | ||
return; | ||
|
||
CadDocument doc = DxfReader.Read(test, this.onNotification); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters