-
Notifications
You must be signed in to change notification settings - Fork 59
Added unit tests to TechnitiumLibrary.IO #32
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
base: master
Are you sure you want to change the base?
Added unit tests to TechnitiumLibrary.IO #32
Conversation
Signed-off-by: Zafer Balkan <zafer@zaferbalkan.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds comprehensive unit tests for the TechnitiumLibrary.IO namespace, building upon the test infrastructure established in PR #29. The tests provide extensive coverage of stream utilities, binary reader/writer extensions, and package management functionality.
Changes:
- Added unit test project configuration (TechnitiumLibrary.UnitTests.csproj) targeting .NET 9.0 with MSTest SDK 4.0.1
- Created 9 comprehensive test files covering all major classes in TechnitiumLibrary.IO
- Added GitHub Actions workflow for continuous testing on Windows using MSBuild
- Updated README with unit testing status badge
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| TechnitiumLibrary.sln | Added TechnitiumLibrary.UnitTests project to the solution with Debug and Release configurations |
| TechnitiumLibrary.UnitTests/TechnitiumLibrary.UnitTests.csproj | Test project configuration with .NET 9.0, MSTest SDK 4.0.1, and nullable reference types enabled |
| TechnitiumLibrary.UnitTests/MSTestSettings.cs | Enables method-level test parallelization for improved test execution performance |
| TechnitiumLibrary.UnitTests/TechnitiumLibrary.IO/*.cs | Nine test files providing comprehensive coverage of stream utilities, binary I/O extensions, and package management |
| .github/workflows/unit-testing.yml | CI/CD workflow for automated testing on Windows with MSBuild (contains project name error) |
| README.md | Added Quality Assurance section with CI status badge |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TechnitiumLibrary.UnitTests/TechnitiumLibrary.IO/OffsetStreamTests.cs
Outdated
Show resolved
Hide resolved
TechnitiumLibrary.UnitTests/TechnitiumLibrary.IO/OffsetStreamTests.cs
Outdated
Show resolved
Hide resolved
TechnitiumLibrary.UnitTests/TechnitiumLibrary.IO/PackageItemTests.cs
Outdated
Show resolved
Hide resolved
TechnitiumLibrary.UnitTests/TechnitiumLibrary.IO/PackageTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try | ||
| { | ||
| CollectionAssert.AreEqual( | ||
| new byte[] { 0x82, 0x01, 0x2C }, | ||
| ms.ToArray() | ||
| ); | ||
| } | ||
| finally | ||
| { | ||
| ms.Dispose(); | ||
| } |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-finally block here is unnecessary. The using statement on line 21 already ensures the MemoryStream is disposed. The manual disposal in the finally block (line 55) is redundant and could cause issues if the stream is already disposed by the using statement when the finally block executes.
| try | ||
| { | ||
| CollectionAssert.AreEqual( | ||
| new byte[] { 0x03, 0xAA, 0xBB, 0xCC }, | ||
| ms.ToArray() | ||
| ); | ||
| } | ||
| finally | ||
| { | ||
| ms.Dispose(); | ||
| } |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-finally block here is unnecessary. The using statement on line 67 already ensures the MemoryStream is disposed. The manual disposal in the finally block (line 84) is redundant and could cause issues if the stream is already disposed by the using statement when the finally block executes.
| try | ||
| { | ||
| CollectionAssert.AreEqual( | ||
| new byte[] { 0x03, 2, 3, 4 }, | ||
| ms.ToArray() | ||
| ); | ||
| } | ||
| finally | ||
| { | ||
| ms.Dispose(); | ||
| } |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-finally block here is unnecessary. The using statement on line 92 already ensures the MemoryStream is disposed. The manual disposal in the finally block (line 109) is redundant and could cause issues if the stream is already disposed by the using statement when the finally block executes.
| try | ||
| { | ||
| CollectionAssert.AreEqual(expected, ms.ToArray()); | ||
| } | ||
| finally | ||
| { | ||
| ms.Dispose(); | ||
| } |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-finally block here is unnecessary. The using statement on line 121 already ensures the MemoryStream is disposed. The manual disposal in the finally block (line 140) is redundant and could cause issues if the stream is already disposed by the using statement when the finally block executes.
| try | ||
| { | ||
| CollectionAssert.AreEqual(expected, ms.ToArray()); | ||
| } | ||
| finally | ||
| { | ||
| ms.Dispose(); | ||
| } |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try-finally block here is unnecessary. The using statement on line 148 already ensures the MemoryStream is disposed. The manual disposal in the finally block (line 168) is redundant and could cause issues if the stream is already disposed by the using statement when the finally block executes.
| try | |
| { | |
| CollectionAssert.AreEqual(expected, ms.ToArray()); | |
| } | |
| finally | |
| { | |
| ms.Dispose(); | |
| } | |
| CollectionAssert.AreEqual(expected, ms.ToArray()); |
| public void WriteShortString_ShouldWriteUtf8EncodedWithLength() | ||
| { | ||
| // GIVEN | ||
| using MemoryStream ms = new MemoryStream(); |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is manually disposed in a finally block - consider a C# using statement as a preferable resource management technique.
| public void WriteShortString_ShouldUseSpecifiedEncoding() | ||
| { | ||
| // GIVEN | ||
| using MemoryStream ms = new MemoryStream(); |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is manually disposed in a finally block - consider a C# using statement as a preferable resource management technique.
Relies on #29 getting merged.