Adds the company tables of SPEC 11.1 behind one generic service so that every table gets the same rules, history, cache and CSV import/export, plus the company profile, fiscal years with monthly lock and the base-data seeder. - 26 coded tables, exchange rates, company profile, fiscal years and periods: entities, maps and migrations 010-014 - TableService + TableCatalog: unique codes, per-table rules (VAT codes are checked by the fiscal pack), delete or disable when in use, single default, CSV export/import all-or-nothing, cache with cross-instance invalidation - CompanyProfileService (Italian identifiers through the pack), FiscalYearService with the date check used by every dated record - EcbRatesClient and the ECB rates system task; CsvReader - ISeeder/SeedRunner with the data version in company settings; base tables from the pack (IBaseTablesTemplate) and an embedded ISO country list Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
using Khaemhat.Fiscal.Abstractions;
|
|
|
|
namespace Khaemhat.Fiscal.Italy.Tests;
|
|
|
|
[TestClass]
|
|
public sealed class ItalianBaseTablesTests
|
|
{
|
|
private static readonly ItalyFiscalPack Pack = new();
|
|
|
|
[TestMethod]
|
|
public void Template_UsesOnlyActiveCodesOfTheFatturaPaLists()
|
|
{
|
|
var template = Pack.Require<IBaseTablesTemplate>();
|
|
var format = Pack.Require<IEInvoiceFormat>();
|
|
|
|
Assert.IsTrue(template.PaymentMethods.All(m => format.PaymentMethods.IsActive(m.EInvoiceCode)));
|
|
Assert.IsTrue(template.PaymentTerms.All(t => format.PaymentConditions.IsActive(t.Condition)));
|
|
Assert.IsTrue(template.DocumentTypes.Where(d => d.EInvoiceType is not null).All(d => format.DocumentTypes.IsActive(d.EInvoiceType)));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void PaymentTerms_AreCompleteAndReferToKnownMethods()
|
|
{
|
|
var template = Pack.Require<IBaseTablesTemplate>();
|
|
var methods = template.PaymentMethods.Select(m => m.Code).ToHashSet(StringComparer.Ordinal);
|
|
|
|
foreach (var terms in template.PaymentTerms)
|
|
{
|
|
Assert.AreEqual(100m, terms.Installments.Sum(i => i.Percent), terms.Code);
|
|
Assert.Contains(terms.PaymentMethodCode, methods, terms.Code);
|
|
Assert.AreEqual(terms.Installments.Count > 1, terms.Condition == "TP01", terms.Code);
|
|
}
|
|
|
|
Assert.AreEqual(template.PaymentTerms.Count, template.PaymentTerms.Select(t => t.Code).Distinct(StringComparer.Ordinal).Count());
|
|
Assert.AreEqual(template.DocumentTypes.Count, template.DocumentTypes.Select(t => t.Code).Distinct(StringComparer.Ordinal).Count());
|
|
}
|
|
}
|