Skip to content

[release/6.0] Introduce SqlXml.CreateReader test files in SqlBinaryXml and Text formats #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/System.Data.Common.TestData/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# System.Data.Common Test Files

## SqlXml.CreateReader

Test files this folder are used by the `SqlXml.CreateReader()` tests to confirm the API can process both Text and SQL Binary XML formats, and that processed SQL Binary XML matches the expected baseline text representations.

### Baseline-Text

These files serve two purposes:

1. They are the baselines used for validating the behavior of processing the `SqlBinaryXml` files
2. They are also used to validate `SqlXml.CreateReader()` can process text files

These files are generated by converting the `SqlBinaryXml` files to text, using the `SqlXml.CreateReader()` API and the following code snippet.

```c#
string sqlBinaryXmlFile = @"SqlBinaryXml\file.bmx";
string textXmlFile = @"Baseline-Text\file.xml";

using FileStream sqlBinaryXmlStream = new FileStream(sqlBinaryXmlFile, FileMode.Open);
SqlXml sqlXml = new(sqlBinaryXmlStream);

using XmlReader sqlXmlReader = sqlXml.CreateReader();
using XmlWriter xmlWriter = new XmlTextWriter(textXmlFile, Encoding.UTF8);

while (sqlXmlReader.Read())
{
xmlWriter.WriteNode(sqlXmlReader, false);
}
```

Because these files are treated as the baselines for the `SqlBinaryXml` validation, they must not be edited independently from the `SqlBinaryXml` files. Even whitespace and formatting changes will cause the tests to fail.

### SqlBinaryXml

These files are stored in SQL Binary XML ([MS-BINXML](https://learn.microsoft.com/en-us/openspecs/sql_server_protocols/ms-binxml/d5bd1f42-8643-435c-a0df-0ba8680a19ee)) format, representing a variety of scenarios salient for `SqlXml` scenarios.

The `SqlXml.CreateReader()` tests process these files and then validate that the results match the XML loaded from the corresponding files in the `Baseline-Text` folder. Therefore, there must be a 1:1 match between the files in the two folders.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- test comments & pis --><root>
<?pi with text?>
<e></e>
<!-- comment -->
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?><!-- test ability to grow buffer for element content --><root>
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root xmlns:a="urn:empty"><a:a></a:a><x><a:a></a:a>some text</x></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root><e /></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root a="abc"><root a="abc"><root a="abc">xyz</root><root />def</root><root /></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<root><!--test element stack growing -->
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:space="preserve"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:lang="en-us"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:space="default"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:lang="en-br"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:space="preserve"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1 xml:lang="fr"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><!-- test ability to grow buffer for tag name --><e0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789>
</e0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root>root<e a="attr-text" x="123" /><e>[text1]</e><e></e><e x="321"><e x="123">[text2]</e></e><!--comment-text-->[text3]<?pi-name pi-text?></root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<e a=" " xml:space="default">
<e a=" " xml:space="preserve">
<e a=" " xml:space="default">
</e>
<e><e /></e>
</e>
<e />
</e>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root> </root>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root a="root" b="prefix:local">root</root>
Loading