diff --git a/Source/DotNET/Screenplay/for_ScreenplayCompiler/invoicing.play b/Source/DotNET/Screenplay/for_ScreenplayCompiler/invoicing.play index a8a052d..d6fc3ef 100644 --- a/Source/DotNET/Screenplay/for_ScreenplayCompiler/invoicing.play +++ b/Source/DotNET/Screenplay/for_ScreenplayCompiler/invoicing.play @@ -677,6 +677,17 @@ module Invoicing screen InvoiceLineReport file Screens/InvoiceLineReport.tsx + slice StateView CancelledInvoices + description "Archive of cancelled invoices - every property auto-maps from the event" + + query ListCancelledInvoices => CancelledInvoiceReadModel[] + authorize IsAccountant + + // No explicit mappings needed - AutoMap is on by default and copies + // every matching property from InvoiceCancelled onto the read model. + projection CancelledInvoices => CancelledInvoiceReadModel + from InvoiceCancelled + slice StateView InvoiceDashboard query GetInvoiceSummary => InvoiceSummaryReadModel diff --git a/Source/DotNET/Screenplay/for_ScreenplayCompiler/when_compiling_the_invoicing_sample.cs b/Source/DotNET/Screenplay/for_ScreenplayCompiler/when_compiling_the_invoicing_sample.cs index e6175f1..daae6dd 100644 --- a/Source/DotNET/Screenplay/for_ScreenplayCompiler/when_compiling_the_invoicing_sample.cs +++ b/Source/DotNET/Screenplay/for_ScreenplayCompiler/when_compiling_the_invoicing_sample.cs @@ -45,7 +45,8 @@ void Because() [Fact] void should_have_the_command_description() => RegisterCommand.Description.ShouldEqual("Registers a new invoice with its lines and payment terms"); [Fact] void should_have_both_layouts() => _result.Value!.Modules.Single().Layouts.Count().ShouldEqual(2); [Fact] void should_have_the_master_detail_slots() => _result.Value!.Modules.Single().Layouts.First().Slots.ShouldContainOnly("sidebar", "main"); - [Fact] void should_have_all_slices() => _feature.Slices.Count().ShouldEqual(13); + [Fact] void should_have_all_slices() => _feature.Slices.Count().ShouldEqual(14); + [Fact] void should_have_the_fully_auto_mapped_projection() => Slice("CancelledInvoices").Projection!.Blocks.OfType().Single().Mappings.ShouldBeEmpty(); [Fact] void should_have_the_nested_feature() => _feature.Features.Single().Name.ShouldEqual("Adjustments"); [Fact] void should_have_the_nested_feature_slices() => _feature.Features.Single().Slices.Select(_ => _.Name).ShouldContainOnly("ApplyDiscount", "WriteOffInvoice"); [Fact] void should_parse_conditional_produces() => RegisterCommand.Produces.Count(_ => _.When is not null).ShouldEqual(4); diff --git a/Source/Screenplay/Monaco/screenplay-editor/samples/invoicing.play b/Source/Screenplay/Monaco/screenplay-editor/samples/invoicing.play index a8a052d..d6fc3ef 100644 --- a/Source/Screenplay/Monaco/screenplay-editor/samples/invoicing.play +++ b/Source/Screenplay/Monaco/screenplay-editor/samples/invoicing.play @@ -677,6 +677,17 @@ module Invoicing screen InvoiceLineReport file Screens/InvoiceLineReport.tsx + slice StateView CancelledInvoices + description "Archive of cancelled invoices - every property auto-maps from the event" + + query ListCancelledInvoices => CancelledInvoiceReadModel[] + authorize IsAccountant + + // No explicit mappings needed - AutoMap is on by default and copies + // every matching property from InvoiceCancelled onto the read model. + projection CancelledInvoices => CancelledInvoiceReadModel + from InvoiceCancelled + slice StateView InvoiceDashboard query GetInvoiceSummary => InvoiceSummaryReadModel