Offerings: lege description/priceNote/ctaLabel toegestaan; ASF-pakketten-seed gevuld; ASF-referentietest gerepareerd

De hosttest op GetReferencedAssemblies faalde in CI (module wordt runtime
gevonden, geen compile-referentie); Offerings-aanwezigheid via capabilities.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 09:19:23 +01:00
co-authored by Claude Sonnet 5.5
parent f2a32b26c9
commit b94245fc12
6 changed files with 58 additions and 22 deletions
@@ -80,12 +80,13 @@ public class HostConfigurationTests
}
[Fact]
public void Host_ReferencesOfferings_ButNotTheMasterModule()
public void Host_DoesNotReferenceTheMasterModule()
{
// Offerings has no compile-time reference from the host (modules are discovered at runtime), so its
// presence is asserted through /System/capabilities in HostPipelineTests instead.
var referenced = typeof(Program).Assembly.GetReferencedAssemblies().Select(a => a.Name);
referenced.Should().Contain("SlpModularCms.Modules.Offerings")
.And.NotContain("SlpModularCms.Modules.Master");
referenced.Should().NotContain("SlpModularCms.Modules.Master");
}
[Fact]
@@ -375,4 +375,23 @@ public class OfferingsServiceTests
ok.Should().Be(valid);
}
[Theory]
[InlineData(typeof(CreateOfferingRequest), "Description", true)]
[InlineData(typeof(CreateOfferingRequest), "PriceNote", true)]
[InlineData(typeof(CreateOfferingRequest), "CtaLabel", true)]
[InlineData(typeof(UpdateOfferingRequest), "Description", true)]
[InlineData(typeof(UpdateOfferingRequest), "PriceNote", true)]
[InlineData(typeof(UpdateOfferingRequest), "CtaLabel", true)]
[InlineData(typeof(CreateOfferingRequest), "Title", false)]
[InlineData(typeof(CreateOfferingRequest), "Price", false)]
public void Request_accepts_empty_text_only_for_description_pricenote_and_cta(Type request, string name, bool emptyAllowed)
{
var parameter = request.GetConstructors()[0].GetParameters().Single(p => p.Name == name);
var required = (System.ComponentModel.DataAnnotations.RequiredAttribute)parameter
.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.RequiredAttribute), false).Single();
required.IsValid(string.Empty).Should().Be(emptyAllowed);
required.IsValid(null).Should().BeFalse();
}
}
@@ -4,11 +4,11 @@ namespace SlpModularCms.Modules.Offerings.Models;
public record CreateOfferingRequest(
[Required, MaxLength(100)] string Title,
[Required, MaxLength(500)] string Description,
[Required(AllowEmptyStrings = true), MaxLength(500)] string Description,
[Required, MaxLength(50)] string Price,
[Required, MaxLength(100)] string PriceNote,
[Required(AllowEmptyStrings = true), MaxLength(100)] string PriceNote,
[Required, FeaturesValidation] List<string> Features,
[Required, MaxLength(50)] string CtaLabel,
[Required(AllowEmptyStrings = true), MaxLength(50)] string CtaLabel,
bool Featured = false,
[MaxLength(130)] string? Slug = null,
Guid? CategoryId = null,
@@ -4,11 +4,11 @@ namespace SlpModularCms.Modules.Offerings.Models;
public record UpdateOfferingRequest(
[Required, MaxLength(100)] string Title,
[Required, MaxLength(500)] string Description,
[Required(AllowEmptyStrings = true), MaxLength(500)] string Description,
[Required, MaxLength(50)] string Price,
[Required, MaxLength(100)] string PriceNote,
[Required(AllowEmptyStrings = true), MaxLength(100)] string PriceNote,
[Required, FeaturesValidation] List<string> Features,
[Required, MaxLength(50)] string CtaLabel,
[Required(AllowEmptyStrings = true), MaxLength(50)] string CtaLabel,
bool Featured = false,
[MaxLength(130)] string? Slug = null,
Guid? CategoryId = null,