Skip to content

Commit e9c1327

Browse files
committed
Clean up tests
1 parent 198a05a commit e9c1327

File tree

1 file changed

+8
-37
lines changed

1 file changed

+8
-37
lines changed

test/Unit/Durable/OrchestrationVersionExtractorTests.cs

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,80 +14,51 @@ public class OrchestrationVersionExtractorTests
1414
[Fact]
1515
public void GetVersionFromHistory_ReturnsNull_WhenHistoryIsNull()
1616
{
17-
// Act
1817
string result = OrchestrationVersionExtractor.GetVersionFromHistory(null);
1918

20-
// Assert
2119
Assert.Null(result);
2220
}
2321

2422
[Fact]
2523
public void GetVersionFromHistory_ReturnsNull_WhenHistoryHasNoExecutionStartedEvent()
2624
{
27-
// Arrange
2825
var historyEvents = new[]
2926
{
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 }
3229
};
3330

34-
// Act
3531
string result = OrchestrationVersionExtractor.GetVersionFromHistory(historyEvents);
3632

37-
// Assert
3833
Assert.Null(result);
3934
}
4035

4136
[Fact]
4237
public void GetVersionFromHistory_ReturnsVersion_WhenExecutionStartedEventExists()
4338
{
44-
// Arrange
45-
const string expectedVersion = "1.0.0";
4639
var historyEvents = new[]
4740
{
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" },
5443
};
5544

56-
// Act
5745
string result = OrchestrationVersionExtractor.GetVersionFromHistory(historyEvents);
5846

59-
// Assert
60-
Assert.Equal(expectedVersion, result);
47+
Assert.Equal("1.0", result);
6148
}
6249

6350
[Fact]
6451
public void GetVersionFromHistory_ReturnsFirstExecutionStartedVersion_WhenMultipleExecutionStartedEventsExist()
6552
{
66-
// Arrange
67-
const string expectedVersion = "1.0.0";
68-
const string secondVersion = "2.0.0";
69-
7053
var historyEvents = new[]
7154
{
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" }
8357
};
8458

85-
// Act
8659
string result = OrchestrationVersionExtractor.GetVersionFromHistory(historyEvents);
8760

88-
// Assert
89-
Assert.Equal(expectedVersion, result);
90-
Assert.NotEqual(secondVersion, result);
61+
Assert.Equal("1.0", result);
9162
}
9263
}
9364
}

0 commit comments

Comments
 (0)