Add wizard UI, general-assembly resolution, and test suite
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>
This commit is contained in:
1 parent
146ce78eae
commit
52483177f0
16 files changed
+1144
-249
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using CadSearchGui;
|
||||
|
||||
namespace CadSearchGui.Tests;
|
||||
|
||||
public class AssemblyComponentScannerTests
|
||||
{
|
||||
private static string ScriviAsmFinto(string testo)
|
||||
{
|
||||
string percorso = Path.GetTempFileName();
|
||||
File.WriteAllBytes(percorso, System.Text.Encoding.Latin1.GetBytes(testo));
|
||||
return percorso;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Scarta_codici_con_una_sola_occorrenza()
|
||||
{
|
||||
// "11112222" compare 2 volte (riferimento vero), "99998888" una sola (rumore).
|
||||
string percorso = ScriviAsmFinto("blah 11112222 blah 99998888 blah 11112222 fine");
|
||||
try
|
||||
{
|
||||
var codici = AssemblyComponentScanner.EstraiCodiciReferenziati(percorso);
|
||||
Assert.Contains("11112222", codici);
|
||||
Assert.DoesNotContain("99998888", codici);
|
||||
}
|
||||
finally { File.Delete(percorso); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Riconosce_sotto_assiemi_con_suffisso_stile_D100()
|
||||
{
|
||||
// Visto su 9244228573.asm: i sotto-assiemi hanno nomi come <codice>_D100/_D200/_D300.
|
||||
string percorso = ScriviAsmFinto("x 9244228573_D100 y 9244228573_D100 z 9244228573_D200 9244228573_D200");
|
||||
try
|
||||
{
|
||||
var codici = AssemblyComponentScanner.EstraiCodiciReferenziati(percorso);
|
||||
Assert.Contains("9244228573_D100", codici);
|
||||
Assert.Contains("9244228573_D200", codici);
|
||||
}
|
||||
finally { File.Delete(percorso); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Non_estrae_nulla_da_una_sequenza_di_cifre_troppo_lunga()
|
||||
{
|
||||
// Una sequenza di 15 cifre di fila non contiene nessun confine di parola valido
|
||||
// per un blocco di 8-12 cifre: non deve produrre falsi positivi troncati.
|
||||
string percorso = ScriviAsmFinto("123456789012345 123456789012345");
|
||||
try
|
||||
{
|
||||
var codici = AssemblyComponentScanner.EstraiCodiciReferenziati(percorso);
|
||||
Assert.Empty(codici);
|
||||
}
|
||||
finally { File.Delete(percorso); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void File_inesistente_lancia_eccezione_IO() =>
|
||||
Assert.Throws<DirectoryNotFoundException>(() =>
|
||||
AssemblyComponentScanner.EstraiCodiciReferenziati(@"C:\non\esiste\pippo.asm.1"));
|
||||
}
|
||||
Reference in new issue
Block a user