@@ -408,4 +408,50 @@ public async Task BranchWithLocalPayload_UnconditionalBranch_AlwaysExecutes()
408408 result . Right . ProcessingResult . Should ( ) . Be ( "Processed with default customization" ) ;
409409 result . Right . CustomizationDetails . Should ( ) . Be ( "Default customization" ) ;
410410 }
411+
412+ [ Fact ]
413+ public async Task BranchWithLocalPayload_UnconditionalBranchFluentApi_AlwaysExecutes ( )
414+ {
415+ // Arrange
416+ var workflow = new WorkflowBuilder < ProductRequest , ProductPayload , ProductResult , ProductError > (
417+ request => new ProductPayload ( request . Id , request . Name , request . Price , request . NeedsCustomProcessing ) ,
418+ payload => new ProductResult (
419+ payload . Id , payload . Name , payload . FinalPrice ,
420+ payload . ProcessingResult , payload . CustomizationDetails )
421+ )
422+ . BranchWithLocalPayload (
423+ // Local payload factory only (no condition parameter)
424+ _ => new CustomizationPayload (
425+ AvailableOptions : new [ ] { "Default Option" } ,
426+ SelectedOptions : new [ ] { "Default Option" } ,
427+ CustomizationCost : 5.00m ,
428+ CustomizationDetails : "Default customization (fluent API)"
429+ ) ,
430+ // Use callback pattern instead of fluent API
431+ branch => branch . Do ( ( mainPayload , localPayload ) =>
432+ {
433+ var updatedMainPayload = mainPayload with
434+ {
435+ FinalPrice = mainPayload . Price + localPayload . CustomizationCost ,
436+ CustomizationDetails = localPayload . CustomizationDetails ,
437+ ProcessingResult = "Processed with fluent API"
438+ } ;
439+
440+ return Either < ProductError , ( ProductPayload , CustomizationPayload ) > . FromRight (
441+ ( updatedMainPayload , localPayload ) ) ;
442+ } )
443+ )
444+ . Build ( ) ;
445+
446+ var request = new ProductRequest ( 1001 , "Test Product" , 100.00m , false ) ;
447+
448+ // Act
449+ var result = await workflow . Execute ( request ) ;
450+
451+ // Assert
452+ result . IsRight . Should ( ) . BeTrue ( ) ;
453+ result . Right . FinalPrice . Should ( ) . Be ( 105.00m ) ; // 100 + 5
454+ result . Right . ProcessingResult . Should ( ) . Be ( "Processed with fluent API" ) ;
455+ result . Right . CustomizationDetails . Should ( ) . Be ( "Default customization (fluent API)" ) ;
456+ }
411457}
0 commit comments