test: add FormProgramService tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FabWorks.Core\FabWorks.Core.csproj" />
|
||||
<ProjectReference Include="..\FabWorks.Api\FabWorks.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
53
FabWorks.Tests/FormProgramServiceTests.cs
Normal file
53
FabWorks.Tests/FormProgramServiceTests.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using FabWorks.Api.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace FabWorks.Tests
|
||||
{
|
||||
public class FormProgramServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void ParseFromFile_SamplePgm_PopulatesMaterialType()
|
||||
{
|
||||
var service = new FormProgramService();
|
||||
var fp = service.ParseFromFile("TestData/sample.pgm");
|
||||
|
||||
// ProgName is empty in the sample file, so verify MaterialType instead
|
||||
Assert.False(string.IsNullOrEmpty(fp.MaterialType));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseFromFile_SamplePgm_PopulatesThickness()
|
||||
{
|
||||
var service = new FormProgramService();
|
||||
var fp = service.ParseFromFile("TestData/sample.pgm");
|
||||
Assert.NotNull(fp.Thickness);
|
||||
Assert.True(fp.Thickness > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseFromFile_SamplePgm_PopulatesBendCount()
|
||||
{
|
||||
var service = new FormProgramService();
|
||||
var fp = service.ParseFromFile("TestData/sample.pgm");
|
||||
Assert.True(fp.BendCount > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseFromFile_SamplePgm_PopulatesToolNames()
|
||||
{
|
||||
var service = new FormProgramService();
|
||||
var fp = service.ParseFromFile("TestData/sample.pgm");
|
||||
Assert.False(string.IsNullOrEmpty(fp.UpperToolNames));
|
||||
Assert.False(string.IsNullOrEmpty(fp.LowerToolNames));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseFromFile_SamplePgm_ComputesContentHash()
|
||||
{
|
||||
var service = new FormProgramService();
|
||||
var fp = service.ParseFromFile("TestData/sample.pgm");
|
||||
Assert.NotNull(fp.ContentHash);
|
||||
Assert.Equal(64, fp.ContentHash.Length); // SHA256 hex = 64 chars
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user