Restructure Form1 into a sequential wizard (database -> import -> raw -> recursive component resolution -> completeness/STEP report), fix case-sensitivity bugs in codice/tipo_file lookups and a word-boundary gap in the assembly scanner that missed _D100-style sub-assembly references, and treat the distinta's general assembly as an ordinary CSV row (derived from the DBP_<codice>_<timestamp> filename) instead of special-casing it throughout. Also adds CadSearchGui.Tests (xUnit) covering the scanner, filename parsing, and the case-insensitive DB lookup behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using CadSearchGui;
|
|
|
|
namespace CadSearchGui.Tests;
|
|
|
|
public class IndexerParseFilenameTests
|
|
{
|
|
[Theory]
|
|
[InlineData("9244228573.asm.41", "9244228573", "asm", 41)]
|
|
[InlineData("9244228573_D100.asm.16", "9244228573_D100", "asm", 16)]
|
|
[InlineData("1504240807.PRT.1", "1504240807", "PRT", 1)]
|
|
public void Estrae_codice_tipo_e_versione_dal_nome_file(
|
|
string nomeFile, string codiceAtteso, string tipoAtteso, int versioneAttesa)
|
|
{
|
|
var (codice, tipo, versione) = Indexer.ParseFilename(nomeFile);
|
|
Assert.Equal(codiceAtteso, codice);
|
|
Assert.Equal(tipoAtteso, tipo);
|
|
Assert.Equal(versioneAttesa, versione);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("9244228573.edz")]
|
|
[InlineData("readme.txt")]
|
|
[InlineData("senza_estensioni")]
|
|
public void File_senza_pattern_codice_tipo_versione_finisce_in_altro(string nomeFile)
|
|
{
|
|
var (codice, tipo, versione) = Indexer.ParseFilename(nomeFile);
|
|
Assert.Equal(nomeFile, codice);
|
|
Assert.Equal("altro", tipo);
|
|
Assert.Null(versione);
|
|
}
|
|
}
|