initial commit
This commit is contained in:
36
tests/TraceCad.Tests/DxfExporterTests.cs
Normal file
36
tests/TraceCad.Tests/DxfExporterTests.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using TraceCad.Core.Geometry;
|
||||
using TraceCad.Core.Model;
|
||||
using TraceCad.Dxf;
|
||||
using Xunit;
|
||||
|
||||
namespace TraceCad.Tests;
|
||||
|
||||
public sealed class DxfExporterTests
|
||||
{
|
||||
[Fact]
|
||||
public void ExportCreatesDxfFile()
|
||||
{
|
||||
var document = SketchDocument.CreateDefault();
|
||||
document.AddEntity(new LineEntity(Guid.NewGuid(), Layer.Cut.Name, new Point2(0, 0), new Point2(100, 0)));
|
||||
document.AddEntity(new CircleEntity(Guid.NewGuid(), Layer.Cut.Name, new Point2(20, 20), 10));
|
||||
document.AddEntity(new ArcEntity(Guid.NewGuid(), Layer.Cut.Name, new Point2(40, 40), 12, 0, 180, false));
|
||||
|
||||
var path = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.dxf");
|
||||
|
||||
try
|
||||
{
|
||||
new NetDxfExporter().Export(document, path);
|
||||
|
||||
Assert.True(File.Exists(path));
|
||||
Assert.True(new FileInfo(path).Length > 0);
|
||||
Assert.Contains("SECTION", File.ReadAllText(path));
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user