Skip to content

Commit 4fe414f

Browse files
committed
docs(mqttrelay-tests): author XML doc comments on test surface
1 parent 67df51a commit 4fe414f

10 files changed

Lines changed: 66 additions & 0 deletions

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/AsyncVoidGuardTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
3333
[TestFixture]
3434
public class AsyncVoidGuardTests
3535
{
36+
/// <summary>Pins the behaviour expressed by the test name: run completes normally when body succeeds.</summary>
37+
/// <returns>The result of the operation.</returns>
3638
[Test]
3739
public async Task Run_completes_normally_when_body_succeeds()
3840
{
@@ -46,6 +48,8 @@ await AsyncVoidGuard.Run(
4648
"Successful body must not invoke the fault logger.");
4749
}
4850

51+
/// <summary>Pins the behaviour expressed by the test name: run routes synchronous throw to logger.</summary>
52+
/// <returns>The result of the operation.</returns>
4953
[Test]
5054
public async Task Run_routes_synchronous_throw_to_logger()
5155
{
@@ -58,6 +62,8 @@ await AsyncVoidGuard.Run(
5862
Assert.That(loggedFault, Is.EqualTo("sync throw"));
5963
}
6064

65+
/// <summary>Pins the behaviour expressed by the test name: run routes async throw to logger.</summary>
66+
/// <returns>The result of the operation.</returns>
6167
[Test]
6268
public async Task Run_routes_async_throw_to_logger()
6369
{
@@ -70,6 +76,8 @@ await AsyncVoidGuard.Run(
7076
Assert.That(loggedFault, Is.EqualTo("async throw"));
7177
}
7278

79+
/// <summary>Pins the behaviour expressed by the test name: run does not rethrow when logger is null.</summary>
80+
/// <returns>The result of the operation.</returns>
7381
[Test]
7482
public async Task Run_does_not_rethrow_when_logger_is_null()
7583
{
@@ -82,6 +90,8 @@ await AsyncVoidGuard.Run(
8290
Assert.Pass();
8391
}
8492

93+
/// <summary>Pins the behaviour expressed by the test name: run does not rethrow when logger itself throws.</summary>
94+
/// <returns>The result of the operation.</returns>
8595
[Test]
8696
public async Task Run_does_not_rethrow_when_logger_itself_throws()
8797
{
@@ -94,6 +104,8 @@ await AsyncVoidGuard.Run(
94104
Assert.Pass();
95105
}
96106

107+
/// <summary>Pins the behaviour expressed by the test name: run no ops when body is null.</summary>
108+
/// <returns>The result of the operation.</returns>
97109
[Test]
98110
public async Task Run_no_ops_when_body_is_null()
99111
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/AvailabilityTopicRegressionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
2929
[TestFixture]
3030
public class AvailabilityTopicRegressionTests
3131
{
32+
/// <summary>Pins the behaviour expressed by the test name: topic never contains probe segment for any inputs.</summary>
3233
[Test]
3334
public void Topic_never_contains_probe_segment_for_any_inputs()
3435
{
@@ -75,6 +76,7 @@ public void Topic_never_contains_probe_segment_for_any_inputs()
7576
}
7677
}
7778

79+
/// <summary>Pins the behaviour expressed by the test name: agent segment is distinct from probe constant.</summary>
7880
[Test]
7981
public void Agent_segment_is_distinct_from_probe_constant()
8082
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/AvailabilityTopicTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
3232
[TestFixture]
3333
public class AvailabilityTopicTests
3434
{
35+
/// <summary>Pins the behaviour expressed by the test name: build returns topic outside probe wildcard.</summary>
3536
[Test]
3637
public void Build_returns_topic_outside_probe_wildcard()
3738
{
@@ -43,6 +44,7 @@ public void Build_returns_topic_outside_probe_wildcard()
4344
"MqttRelay availability topic must not fall under the Probe/# wildcard.");
4445
}
4546

47+
/// <summary>Pins the behaviour expressed by the test name: build uses dedicated agent segment.</summary>
4648
[Test]
4749
public void Build_uses_dedicated_agent_segment()
4850
{
@@ -57,6 +59,7 @@ public void Build_uses_dedicated_agent_segment()
5759
Assert.That(topic, Is.EqualTo("MTConnect/Agent/agent-uuid-1/Available"));
5860
}
5961

62+
/// <summary>Pins the behaviour expressed by the test name: build preserves multi segment topic prefix.</summary>
6063
[Test]
6164
public void Build_preserves_multi_segment_topic_prefix()
6265
{
@@ -72,30 +75,35 @@ public void Build_preserves_multi_segment_topic_prefix()
7275
Assert.That(topic, Does.Not.Contain("/Probe/"));
7376
}
7477

78+
/// <summary>Pins the behaviour expressed by the test name: build returns null when topic prefix is null.</summary>
7579
[Test]
7680
public void Build_returns_null_when_topic_prefix_is_null()
7781
{
7882
Assert.That(AvailabilityTopic.Build(null, "agent-uuid-1"), Is.Null);
7983
}
8084

85+
/// <summary>Pins the behaviour expressed by the test name: build returns null when topic prefix is empty.</summary>
8186
[Test]
8287
public void Build_returns_null_when_topic_prefix_is_empty()
8388
{
8489
Assert.That(AvailabilityTopic.Build(string.Empty, "agent-uuid-1"), Is.Null);
8590
}
8691

92+
/// <summary>Pins the behaviour expressed by the test name: build returns null when agent uuid is null.</summary>
8793
[Test]
8894
public void Build_returns_null_when_agent_uuid_is_null()
8995
{
9096
Assert.That(AvailabilityTopic.Build("MTConnect", null), Is.Null);
9197
}
9298

99+
/// <summary>Pins the behaviour expressed by the test name: build returns null when agent uuid is empty.</summary>
93100
[Test]
94101
public void Build_returns_null_when_agent_uuid_is_empty()
95102
{
96103
Assert.That(AvailabilityTopic.Build("MTConnect", string.Empty), Is.Null);
97104
}
98105

106+
/// <summary>Pins the behaviour expressed by the test name: available segment constant pins trailing topic segment.</summary>
99107
[Test]
100108
public void AvailableSegment_constant_pins_trailing_topic_segment()
101109
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/AvailabilityTopicValidationTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
2626
[TestFixture]
2727
public class AvailabilityTopicValidationTests
2828
{
29+
/// <summary>Pins the behaviour expressed by the test name: build returns null when reserved character present.</summary>
30+
/// <param name="topicPrefix">The topic prefix.</param>
31+
/// <param name="agentUuid">The agent uuid.</param>
2932
[TestCase("MTConnect+", "agent-uuid-1")]
3033
[TestCase("MTConnect#", "agent-uuid-1")]
3134
[TestCase("MTConnect\0", "agent-uuid-1")]
@@ -41,6 +44,9 @@ public void Build_returns_null_when_reserved_character_present(
4144
$"Build({topicPrefix}, {agentUuid}) should reject MQTT-reserved characters.");
4245
}
4346

47+
/// <summary>Pins the behaviour expressed by the test name: build returns null when input is whitespace only.</summary>
48+
/// <param name="topicPrefix">The topic prefix.</param>
49+
/// <param name="agentUuid">The agent uuid.</param>
4450
[TestCase(" ", "agent-uuid-1")]
4551
[TestCase("MTConnect", " ")]
4652
public void Build_returns_null_when_input_is_whitespace_only(
@@ -56,6 +62,7 @@ public void Build_returns_null_when_input_is_whitespace_only(
5662
$"Build({topicPrefix}, {agentUuid}) should reject whitespace-only input.");
5763
}
5864

65+
/// <summary>Pins the behaviour expressed by the test name: build rejects slash inside agent uuid segment.</summary>
5966
[Test]
6067
public void Build_rejects_slash_inside_agent_uuid_segment()
6168
{
@@ -67,6 +74,7 @@ public void Build_rejects_slash_inside_agent_uuid_segment()
6774
Is.Null);
6875
}
6976

77+
/// <summary>Pins the behaviour expressed by the test name: build strips leading slash from topic prefix.</summary>
7078
[Test]
7179
public void Build_strips_leading_slash_from_topic_prefix()
7280
{
@@ -79,6 +87,7 @@ public void Build_strips_leading_slash_from_topic_prefix()
7987
Is.EqualTo("MTConnect/Agent/agent-1/Available"));
8088
}
8189

90+
/// <summary>Pins the behaviour expressed by the test name: build strips trailing slash from topic prefix.</summary>
8291
[Test]
8392
public void Build_strips_trailing_slash_from_topic_prefix()
8493
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/LastSentSequencePersisterTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
2323
[TestFixture]
2424
public class LastSentSequencePersisterTests
2525
{
26+
/// <summary>Pins the behaviour expressed by the test name: update marks dirty and round trips through read.</summary>
2627
[Test]
2728
public void Update_marks_dirty_and_round_trips_through_read()
2829
{
@@ -35,6 +36,7 @@ public void Update_marks_dirty_and_round_trips_through_read()
3536
"An in-memory update must mark the persister dirty so the caller knows to flush.");
3637
}
3738

39+
/// <summary>Pins the behaviour expressed by the test name: read does not clear dirty bit.</summary>
3840
[Test]
3941
public void Read_does_not_clear_dirty_bit()
4042
{
@@ -47,6 +49,7 @@ public void Read_does_not_clear_dirty_bit()
4749
"Read must not clear dirty: only Flush establishes durable persistence.");
4850
}
4951

52+
/// <summary>Pins the behaviour expressed by the test name: try flush writes only when dirty and clears dirty on success.</summary>
5053
[Test]
5154
public void TryFlush_writes_only_when_dirty_and_clears_dirty_on_success()
5255
{
@@ -63,6 +66,7 @@ public void TryFlush_writes_only_when_dirty_and_clears_dirty_on_success()
6366
"After a successful flush the persister must be clean so the next timer tick does not redundantly write.");
6467
}
6568

69+
/// <summary>Pins the behaviour expressed by the test name: try flush no ops when not dirty.</summary>
6670
[Test]
6771
public void TryFlush_no_ops_when_not_dirty()
6872
{
@@ -76,6 +80,7 @@ public void TryFlush_no_ops_when_not_dirty()
7680
"A clean persister must not invoke the writer; that would burn IOPS for no progress.");
7781
}
7882

83+
/// <summary>Pins the behaviour expressed by the test name: try flush keeps dirty when writer throws.</summary>
7984
[Test]
8085
public void TryFlush_keeps_dirty_when_writer_throws()
8186
{
@@ -92,6 +97,7 @@ public void TryFlush_keeps_dirty_when_writer_throws()
9297
Assert.That(persister.Read(), Is.EqualTo(123UL));
9398
}
9499

100+
/// <summary>Pins the behaviour expressed by the test name: update is a last write wins overwrite.</summary>
95101
[Test]
96102
public void Update_is_a_last_write_wins_overwrite()
97103
{
@@ -103,6 +109,7 @@ public void Update_is_a_last_write_wins_overwrite()
103109
"Last write wins; the persister is not a max-watermark.");
104110
}
105111

112+
/// <summary>Pins the behaviour expressed by the test name: initialize seeds value without marking dirty.</summary>
106113
[Test]
107114
public void Initialize_seeds_value_without_marking_dirty()
108115
{
@@ -118,6 +125,7 @@ public void Initialize_seeds_value_without_marking_dirty()
118125
"Initialize seeds the in-memory value from disk and must not request a redundant flush.");
119126
}
120127

128+
/// <summary>Pins the behaviour expressed by the test name: try flush no ops when writer is null.</summary>
121129
[Test]
122130
public void TryFlush_no_ops_when_writer_is_null()
123131
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleDisconnectTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
2929
[TestFixture]
3030
public class MqttRelayLifecycleDisconnectTests
3131
{
32+
/// <summary>Pins the behaviour expressed by the test name: disconnect with timeout returns when disconnect completes.</summary>
3233
[Test]
3334
public void DisconnectWithTimeout_returns_when_disconnect_completes()
3435
{
@@ -45,6 +46,7 @@ public void DisconnectWithTimeout_returns_when_disconnect_completes()
4546
"Successful disconnect must not invoke the fault logger.");
4647
}
4748

49+
/// <summary>Pins the behaviour expressed by the test name: disconnect with timeout logs fault when disconnect throws.</summary>
4850
[Test]
4951
public void DisconnectWithTimeout_logs_fault_when_disconnect_throws()
5052
{
@@ -59,6 +61,7 @@ public void DisconnectWithTimeout_logs_fault_when_disconnect_throws()
5961
"A faulted disconnect Task must surface its exception to the logger.");
6062
}
6163

64+
/// <summary>Pins the behaviour expressed by the test name: disconnect with timeout returns after timeout when disconnect hangs.</summary>
6265
[Test]
6366
public void DisconnectWithTimeout_returns_after_timeout_when_disconnect_hangs()
6467
{
@@ -77,6 +80,7 @@ public void DisconnectWithTimeout_returns_after_timeout_when_disconnect_hangs()
7780
"Hung disconnect must bail out near the configured timeout.");
7881
}
7982

83+
/// <summary>Pins the behaviour expressed by the test name: disconnect with timeout does not throw when disconnect factory throws synchronously.</summary>
8084
[Test]
8185
public void DisconnectWithTimeout_does_not_throw_when_disconnect_factory_throws_synchronously()
8286
{
@@ -93,6 +97,7 @@ public void DisconnectWithTimeout_does_not_throw_when_disconnect_factory_throws_
9397
Assert.That(loggedFault, Is.EqualTo("sync throw"));
9498
}
9599

100+
/// <summary>Pins the behaviour expressed by the test name: disconnect with timeout no ops when disconnect factory is null.</summary>
96101
[Test]
97102
public void DisconnectWithTimeout_no_ops_when_disconnect_factory_is_null()
98103
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/MqttRelayLifecycleStopTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
2424
[TestFixture]
2525
public class MqttRelayLifecycleStopTests
2626
{
27+
/// <summary>Pins the behaviour expressed by the test name: stop servers does not throw when both servers null.</summary>
2728
[Test]
2829
public void StopServers_does_not_throw_when_both_servers_null()
2930
{
@@ -34,6 +35,7 @@ public void StopServers_does_not_throw_when_both_servers_null()
3435
() => MqttRelayLifecycle.StopServers(documentStop: null, entityStop: null));
3536
}
3637

38+
/// <summary>Pins the behaviour expressed by the test name: stop servers invokes document stop when provided.</summary>
3739
[Test]
3840
public void StopServers_invokes_document_stop_when_provided()
3941
{
@@ -46,6 +48,7 @@ public void StopServers_invokes_document_stop_when_provided()
4648
"Document-mode shutdown must invoke the document-server stop action.");
4749
}
4850

51+
/// <summary>Pins the behaviour expressed by the test name: stop servers invokes entity stop when provided.</summary>
4952
[Test]
5053
public void StopServers_invokes_entity_stop_when_provided()
5154
{
@@ -58,6 +61,7 @@ public void StopServers_invokes_entity_stop_when_provided()
5861
"Entity-mode shutdown must invoke the entity-server stop action.");
5962
}
6063

64+
/// <summary>Pins the behaviour expressed by the test name: stop servers invokes both when both provided.</summary>
6165
[Test]
6266
public void StopServers_invokes_both_when_both_provided()
6367
{
@@ -72,6 +76,7 @@ public void StopServers_invokes_both_when_both_provided()
7276
Assert.That(entityStopped, Is.True);
7377
}
7478

79+
/// <summary>Pins the behaviour expressed by the test name: stop servers swallows document stop exception and runs entity stop.</summary>
7580
[Test]
7681
public void StopServers_swallows_document_stop_exception_and_runs_entity_stop()
7782
{

tests/MTConnect.NET-AgentModule-MqttRelay-Tests/ObservationGrouperTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ namespace MTConnect.AgentModule.MqttRelay.Tests
3838
[TestFixture]
3939
public class ObservationGrouperTests
4040
{
41+
/// <summary>Pins the behaviour expressed by the test name: group by data item returns empty when input null.</summary>
4142
[Test]
4243
public void GroupByDataItem_returns_empty_when_input_null()
4344
{
4445
Assert.That(ObservationGrouper.GroupByDataItem(null), Is.Empty);
4546
}
4647

48+
/// <summary>Pins the behaviour expressed by the test name: group by data item returns empty when input empty.</summary>
4749
[Test]
4850
public void GroupByDataItem_returns_empty_when_input_empty()
4951
{
@@ -52,6 +54,7 @@ public void GroupByDataItem_returns_empty_when_input_empty()
5254
Is.Empty);
5355
}
5456

57+
/// <summary>Pins the behaviour expressed by the test name: group by data item groups observations by data item id.</summary>
5558
[Test]
5659
public void GroupByDataItem_groups_observations_by_data_item_id()
5760
{
@@ -78,6 +81,7 @@ public void GroupByDataItem_groups_observations_by_data_item_id()
7881
Assert.That(groupC.Select(o => o.Sequence), Is.EquivalentTo(new ulong[] { 4 }));
7982
}
8083

84+
/// <summary>Pins the behaviour expressed by the test name: group by data item iterates source exactly once.</summary>
8185
[Test]
8286
public void GroupByDataItem_iterates_source_exactly_once()
8387
{
@@ -103,6 +107,7 @@ IEnumerable<IObservationOutput> Source()
103107
Assert.That(groups, Has.Count.EqualTo(2));
104108
}
105109

110+
/// <summary>Pins the behaviour expressed by the test name: group by data item preserves first seen order per group.</summary>
106111
[Test]
107112
public void GroupByDataItem_preserves_first_seen_order_per_group()
108113
{
@@ -121,6 +126,7 @@ public void GroupByDataItem_preserves_first_seen_order_per_group()
121126
Is.EqualTo(new ulong[] { 10, 11, 12 }));
122127
}
123128

129+
/// <summary>Pins the behaviour expressed by the test name: group by data item handles null data item id as distinct group.</summary>
124130
[Test]
125131
public void GroupByDataItem_handles_null_data_item_id_as_distinct_group()
126132
{

0 commit comments

Comments
 (0)