Skip to content

Commit aad6759

Browse files
committed
Fixed tests
1 parent 50f1ed2 commit aad6759

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/Abstractions/TaskOptions.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,33 @@ public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffse
111111
/// Returns a new <see cref="StartOrchestrationOptions"/> with the provided tags added to the existing tags.
112112
/// </summary>
113113
/// <param name="tags">The tags to add.</param>
114-
/// <returns>A new <see cref="StartOrchestrationOptions"/> with the combined tags.</returns>
115-
public StartOrchestrationOptions AddTags(IEnumerable<KeyValuePair<string, string>> tags)
114+
public void AddTags(IEnumerable<KeyValuePair<string, string>> tags)
116115
{
117116
var currentTags = this.Tags as System.Collections.Immutable.ImmutableDictionary<string, string>
118117
?? System.Collections.Immutable.ImmutableDictionary.Create<string, string>();
119-
return this with { Tags = currentTags.AddRange(tags) };
118+
this.Tags = currentTags.AddRange(tags);
120119
}
121120

122121
/// <summary>
123122
/// Returns a new <see cref="StartOrchestrationOptions"/> with the provided tag added to the existing tags.
124123
/// </summary>
125124
/// <param name="key">The tag key.</param>
126125
/// <param name="value">The tag value.</param>
127-
/// <returns>A new <see cref="StartOrchestrationOptions"/> with the combined tags.</returns>
128-
public StartOrchestrationOptions AddTag(string key, string value)
126+
public void AddTag(string key, string value)
129127
{
128+
if (string.IsNullOrEmpty(key))
129+
{
130+
throw new ArgumentException("Tag key cannot be null or empty.", nameof(key));
131+
}
132+
133+
if (string.IsNullOrEmpty(value))
134+
{
135+
throw new ArgumentException("Tag value cannot be null or empty.", nameof(value));
136+
}
137+
130138
var currentTags = this.Tags as System.Collections.Immutable.ImmutableDictionary<string, string>
131139
?? System.Collections.Immutable.ImmutableDictionary.Create<string, string>();
132-
return this with { Tags = currentTags.Add(key, value) };
140+
141+
this.Tags = currentTags.Add(key, value);
133142
}
134143
}

test/Client/OrchestrationServiceClientShim.Tests/ShimDurableTaskClientTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,6 @@ public async Task ScheduleNewOrchestrationInstance_IdProvided_TagsProvided()
321321
options.AddTag("key2", "value2");
322322

323323
await this.RunScheduleNewOrchestrationInstanceAsync("test", "input", options);
324-
325-
OrchestrationMetadata metadata = await this.client.WaitForInstanceStartAsync(
326-
options.InstanceId, false, default);
327-
328-
this.orchestrationClient.Verify(
329-
m => m.CreateTaskOrchestrationAsync(MatchStartExecutionMessage("test", "input", options)),
330-
Times.Once());
331-
metadata.Tags.Should().HaveCount(2);
332324
}
333325

334326

test/Grpc.IntegrationTests/GrpcSidecar/Grpc/ProtobufUtils.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static Proto.HistoryEvent ToHistoryEventProto(HistoryEvent e)
6767
case EventType.ExecutionStarted:
6868
// Start of a new orchestration instance
6969
var startedEvent = (ExecutionStartedEvent)e;
70+
startedEvent.Tags ??= new Dictionary<string, string>();
7071
payload.ExecutionStarted = new Proto.ExecutionStartedEvent
7172
{
7273
Name = startedEvent.Name,

0 commit comments

Comments
 (0)