Files
prep-step/PrepStep.Tests/IndexerParseFilenameTests.cs
davideandClaude Sonnet 5 13798ad47c Add explicit working folder; rename project from CadSearchGui to PrepStep
Working folder (phase 1): CSV/raw/step/step_finali all used to live split
across two different implicit locations (CSV in the "repo root" found by
walking up for CLAUDE.md, raw/step next to the input distinta file) with
neither shown to the user. That repo-root lookup also silently breaks once
the app runs as a standalone published exe on a machine with no repo/
CLAUDE.md at all. Replaced both with one explicit "cartella di lavoro",
auto-suggested (last used, remembered the same way as the DB path) and
changeable from phase 1, with no dependency on any repo marker file.

Rename: CadSearchGui was the working name from before the app had a
product identity; renamed folders, csproj files, namespace and the
AppData settings folder to PrepStep throughout, matching the exe name
already in use. Product-facing name stays "Cevolani StepPrep".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-21 11:18:43 +02:00

32 lines
1.0 KiB
C#

using PrepStep;
namespace PrepStep.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);
}
}