perf(mtconnect): stream sample-chunk parsing through XmlReader; no per-chunk document tree
This commit is contained in:
@@ -1061,6 +1061,30 @@ public sealed class MTConnectStreamsParseTests
|
||||
observation.DataItemId.ShouldBe("ds");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_indentation_between_child_entries_is_not_part_of_the_value()
|
||||
{
|
||||
// The parser reads forward-only off an XmlReader, and the value it reports is the
|
||||
// concatenation of the text it meets on the way. That concatenation only matches what the
|
||||
// XDocument it replaced reported because whitespace-only text nodes are dropped
|
||||
// (XmlReaderSettings.IgnoreWhitespace, which is what XDocument.Load defaulted to) — so
|
||||
// entries separated by a line break must still read "12", never "1\n 2". Nothing else in
|
||||
// this file can tell the two settings apart: the DATA_SET case above writes its entries
|
||||
// adjacent, and every other observation is a single text node that Trim() cleans up either
|
||||
// way. The observation index codes a structured observation BadNotSupported, so the value
|
||||
// itself is not what matters here — the setting is, and this is the only test that moves
|
||||
// when it changes.
|
||||
var result = MTConnectStreamsParser.Parse(StreamsDocument(
|
||||
"""
|
||||
<Events><PathFeedrateOverride dataItemId="ds" timestamp="2026-07-24T12:00:00Z" count="2">
|
||||
<Entry key="V1">1</Entry>
|
||||
<Entry key="V2">2</Entry>
|
||||
</PathFeedrateOverride></Events>
|
||||
"""));
|
||||
|
||||
result.Observations.ShouldHaveSingleItem().Value.ShouldBe("12");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_plain_text_observation_containing_spaces_is_NOT_flagged_structured()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user