@@ -19,41 +19,38 @@ public class DefaultActivityExecutionMapperTests
1919 private readonly Mock < ICompressionCodecResolver > _compressionCodecResolverMock = new ( ) ;
2020 private readonly Mock < IOptions < ManagementOptions > > _optionsMock = new ( ) ;
2121 private readonly DefaultActivityExecutionMapper _sut ;
22- using Elsa . Common ;
23- using Elsa . Common . Codecs ;
24- using Elsa . Workflows . Management . Options ;
25- using Elsa . Workflows . Runtime ;
26- using Microsoft . Extensions . Options ;
27- using Moq ;
28- using Xupusing Elsa . Commont . using Elsa . Workflows . Mans ( using Elsa . Workflows. Runtime;
29- using Mic using Microsoft. Extensions. Oviusing Moq;
30- using Xunit;
31- using Elsafeusing XunrMusing Elsa.
32- using Elsa. Workflows;
33- using Micckusing Microsoft. Exte _using System. Collections. Generic;
34- using System _optionsMock. Object ) ;
35- }
36- [ using public async Task Manamespace Elsa. Workflows. rectly_WhenCircularReferenceExists( )
22+
23+ public DefaultActivityExecutionMapperTests ( )
3724 {
38- // A{
39- private readonly Mock < ISafeSerializer > _s ;
40- private readonly Mock < IPayloadSerializer > _payloadSerializerMock = Ro private readonly Mock< ICompressionCodecResolver> _compressionCodecResolvon private readonly Mock < IOptions < ManagementOptions > > _optionsMock = new ( ) ;
41- private ron private readonly DefaultActivityExecutionMapper _sut;
42- using Elsa . Commoty using Elsa . Common ;
43- using Elsa . Common . Codecs ;
44- usiefault ) ;
45- using Elsa . Common . tB = new ActivityExecutionCousing El ", w, null, root, contextRoot.Actusing Microsoft.Extensions.O.Susing Moq;
46- using Xupusing Elsa . Com using Xupreusing Mic using Microsoft . Extensions . Oviusing Moq ;
47- using Xunit ;
48- using Elsafeusing using Xunit;
49- using Elsafeusing XunrMusing Elsa .
50- using Elsafis using Elsa . Workflows ;
51- using Micc eusing Micckusing using System _optionsMock . Object) ;
25+ _optionsMock . Setup ( x => x . Value ) . Returns ( new ManagementOptions ( ) ) ;
26+ _compressionCodecResolverMock . Setup ( x => x . Resolve ( It . IsAny < string > ( ) ) ) . Returns ( new Mock < ICompressionCodec > ( ) . Object ) ;
27+
28+ _sut = new DefaultActivityExecutionMapper (
29+ _safeSerializerMock . Object ,
30+ _payloadSerializerMock . Object ,
31+ _compressionCodecResolverMock . Object ,
32+ _optionsMock . Object ) ;
5233 }
53- [ using ActivityExe }
54- [ using public async T A {
55- record = await _sut . MapAsync ( contextA ) ;
34+
35+ [ Fact ]
36+ public async Task MapAsync_SetsCallStackDepth_FromContext ( )
37+ {
38+ // Arrange
39+ var root = new WriteLine ( "root" ) ;
40+ var fixture = new ActivityTestFixture ( root ) ;
41+ var contextRoot = await fixture . BuildAsync ( ) ;
42+ var w = contextRoot . WorkflowExecutionContext ;
43+ var clock = contextRoot . GetRequiredService < ISystemClock > ( ) ;
44+
45+ var contextA = new ActivityExecutionContext ( "A" , w , null , root , contextRoot . ActivityDescriptor , contextRoot . StartedAt , null , clock , default )
46+ {
47+ CallStackDepth = 5
48+ } ;
49+
50+ // Act
51+ var record = await _sut . MapAsync ( contextA ) ;
52+
5653 // Assert
57- Assert . Equal ( 2 , record . CallStackDepth ) ;
54+ Assert . Equal ( 5 , record . CallStackDepth ) ;
5855 }
5956}
0 commit comments