ComplianceNFs/AuditComplianceNFs.cs

42 lines
2.8 KiB
C#

// 📋 Copilot Audit Prompt: ComplianceNFs Project Validator
//
// Purpose:
// Automatically review the ComplianceNFs solution and report whether
// each major requirement from the initial design prompt is implemented.
//
// Instructions to Copilot:
// Write a C# console app or NUnit/xUnit test suite that:
// 1. Loads the ComplianceNFs solution structure (projects: .Service, .Monitor, .Core, .Infrastructure).
// 2. Verifies that each project exists and follows naming conventions.
// 3. In ComplianceNFs.Core:
// • Confirms presence of BuyingRecord, EnergyInvoice, InvoiceStatus enum.
// • Confirms interfaces IMailListener, IXmlParser, IPdfParser, IAccessDbRepository, IAttachmentRepository.
// 4. In ComplianceNFs.Infrastructure:
// • Checks for classes implementing each interface (AccessDbRepository, AttachmentRepository, MailListener, XmlParser, PdfParser).
// • Confirms a FileArchiver or equivalent that creates status subfolders under ArchiveBasePath.
// 5. In ComplianceNFs.Service:
// • Confirms a Generic Host (`Host.CreateDefaultBuilder`) and DI registration for all services.
// • Asserts that MailListener is started on host startup.
// • Reads configuration from appsettings.json (AccessConnectionString, PostgresConnectionString, Mail settings, Tolerances, ArchiveBasePath).
// 6. In ComplianceNFs.Monitor:
// • Checks for a WPF application with a MainWindow, MonitorViewModel, and a “Force Scan” button wired to trigger ingestion.
// 7. Workflow & Logic Checks:
// • Ensures MatchingService applies primary key match (CNPJ_comp, CNPJ_vend, MontLO vs MontNF ±1%, PrecLO vs PrecNF ±0.5%).
// • Ensures fallback-by-date logic (invoiceDate minus 1 month → match on Mes/Ano).
// • Ensures multi-invoice sum check for volume matches.
// • Ensures ComplianceService computes implied tax and compares within ±1%.
// • Ensures NotificationService sends email on mismatches.
// • Ensures ArchivingService moves files into subfolders named for each InvoiceStatus.
// 8. Configuration Validations:
// • Reads appsettings.json and asserts each required key exists.
// 9. Produces a summary report (console output or test results) listing “Pass” or “Fail” for each check,
// and points to the file/line where a missing or mis-configured item was detected.
//
// Approach:
// • Use reflection or simple file parsing (e.g. Roslyn) to find classes, interfaces, methods.
// • Use JSON parsing to read and validate appsettings.json.
// • Optionally scaffold unit tests that assert the numeric tolerances and fallback logic via small in-memory examples.
// • Output a clear, human-readable checklist with file paths and suggestions for fixes.
//
// Begin generating the auditing code now.