@@ -14,80 +14,51 @@ public class OrchestrationVersionExtractorTests
14
14
[ Fact ]
15
15
public void GetVersionFromHistory_ReturnsNull_WhenHistoryIsNull ( )
16
16
{
17
- // Act
18
17
string result = OrchestrationVersionExtractor . GetVersionFromHistory ( null ) ;
19
18
20
- // Assert
21
19
Assert . Null ( result ) ;
22
20
}
23
21
24
22
[ Fact ]
25
23
public void GetVersionFromHistory_ReturnsNull_WhenHistoryHasNoExecutionStartedEvent ( )
26
24
{
27
- // Arrange
28
25
var historyEvents = new [ ]
29
26
{
30
- new HistoryEvent { EventType = HistoryEventType . TaskScheduled , EventId = 1 } ,
31
- new HistoryEvent { EventType = HistoryEventType . TaskCompleted , EventId = 2 , TaskScheduledId = 1 }
27
+ new HistoryEvent { EventType = HistoryEventType . OrchestratorStarted } ,
28
+ new HistoryEvent { EventType = HistoryEventType . TaskScheduled }
32
29
} ;
33
30
34
- // Act
35
31
string result = OrchestrationVersionExtractor . GetVersionFromHistory ( historyEvents ) ;
36
32
37
- // Assert
38
33
Assert . Null ( result ) ;
39
34
}
40
35
41
36
[ Fact ]
42
37
public void GetVersionFromHistory_ReturnsVersion_WhenExecutionStartedEventExists ( )
43
38
{
44
- // Arrange
45
- const string expectedVersion = "1.0.0" ;
46
39
var historyEvents = new [ ]
47
40
{
48
- new HistoryEvent {
49
- EventType = HistoryEventType . ExecutionStarted ,
50
- EventId = 1 ,
51
- Version = expectedVersion
52
- } ,
53
- new HistoryEvent { EventType = HistoryEventType . TaskScheduled , EventId = 2 }
41
+ new HistoryEvent { EventType = HistoryEventType . OrchestratorStarted } ,
42
+ new HistoryEvent { EventType = HistoryEventType . ExecutionStarted , Version = "1.0" } ,
54
43
} ;
55
44
56
- // Act
57
45
string result = OrchestrationVersionExtractor . GetVersionFromHistory ( historyEvents ) ;
58
46
59
- // Assert
60
- Assert . Equal ( expectedVersion , result ) ;
47
+ Assert . Equal ( "1.0" , result ) ;
61
48
}
62
49
63
50
[ Fact ]
64
51
public void GetVersionFromHistory_ReturnsFirstExecutionStartedVersion_WhenMultipleExecutionStartedEventsExist ( )
65
52
{
66
- // Arrange
67
- const string expectedVersion = "1.0.0" ;
68
- const string secondVersion = "2.0.0" ;
69
-
70
53
var historyEvents = new [ ]
71
54
{
72
- new HistoryEvent {
73
- EventType = HistoryEventType . ExecutionStarted ,
74
- EventId = 1 ,
75
- Version = expectedVersion
76
- } ,
77
- new HistoryEvent { EventType = HistoryEventType . TaskScheduled , EventId = 2 } ,
78
- new HistoryEvent {
79
- EventType = HistoryEventType . ExecutionStarted ,
80
- EventId = 3 ,
81
- Version = secondVersion
82
- }
55
+ new HistoryEvent { EventType = HistoryEventType . ExecutionStarted , Version = "1.0" } ,
56
+ new HistoryEvent { EventType = HistoryEventType . ExecutionStarted , Version = "2.0" }
83
57
} ;
84
58
85
- // Act
86
59
string result = OrchestrationVersionExtractor . GetVersionFromHistory ( historyEvents ) ;
87
60
88
- // Assert
89
- Assert . Equal ( expectedVersion , result ) ;
90
- Assert . NotEqual ( secondVersion , result ) ;
61
+ Assert . Equal ( "1.0" , result ) ;
91
62
}
92
63
}
93
64
}
0 commit comments