Skip to content

Read XML: net10.0, MSTest 4.5.2, read an XML file from the output folder - #2334

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/104103-csharp-reading-xml-documents
Nov 3, 2026
Merged

vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/104103-csharp-reading-xml-documents

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves the ReadXML sample to net10.0 with Microsoft.NET.Test.Sdk 18.11.0, MSTest 4.5.2 and coverlet.collector 10.1.0, replacing Assert.ThrowsException with Assert.ThrowsExactly. Adds people.xml with a copy-to-output item, ReadXmlFromFile (XDocument.Load and XmlReader.Create on a path built from AppContext.BaseDirectory) and ReadXmlUsingXmlDocument, each covered by a new test, plus a test that a missing file throws FileNotFoundException. ReadNamesAndAges becomes ReadNamesAndSurnames without the stray block after the using declaration, and Program.cs gains the file-reading demos. All 14 tests pass locally.

Retarget ReadXML and Tests to net10.0 and move the test packages to
Microsoft.NET.Test.Sdk 18.11.0, MSTest 4.5.2 and coverlet.collector 10.1.0
(Assert.ThrowsException becomes Assert.ThrowsExactly). Add people.xml with
a copy-to-output item, ReadXmlFromFile (XDocument.Load and XmlReader.Create)
and ReadXmlUsingXmlDocument, with four tests. Rename ReadNamesAndAges to
ReadNamesAndSurnames and drop the stray block after the using declaration.
Program.cs gains the file-reading demos.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit 20c2083 into CodeMazeBlog:main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant