Skip to content

Add tests for Manifest serialization and deserialization - #1899

Merged
lbussell merged 12 commits into
dotnet:mainfrom
lbussell:serialization-tests
Dec 19, 2025
Merged

lbussell merged 12 commits into
dotnet:mainfrom
lbussell:serialization-tests

Conversation

@lbussell

@lbussell lbussell commented Dec 19, 2025 •

Copy link
Copy Markdown
Member

This PR adds tests that assert all of the functionality around ImageBuilder's Manifest models. They make sure required properties are actually required, ensure that string-enum conversion works correctly, and ensure that serialization/deserialization is consistent in both directions as well as round-trip serialization.

With these tests in place, we can be more confident with the following types of changes in the future:

  • Migrating from Newtonsoft.Json to System.Text.Json
  • Moving the Manifest models to the ImageBuilder.Models package
  • Enabling nullable annotations
  • Changing to immutable models/records

Also included some minor formatting changes:

  • The file header template in .editorconfig didn't match up with lots of files. I counted the occurrences of each header and changed the .editorconfig to match the more common one.
  • Fixed the file headers in ImageBuilder Manifest models
  • Converted ImageBuilder Manifest models to file-scoped namespaces

@lbussell
lbussell requested a review from a team as a code owner December 19, 2025 16:33
@lbussell
lbussell requested review from Copilot and removed request for a team December 19, 2025 16:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ImageBuilder project by adding comprehensive serialization tests for Manifest models and applying consistent code formatting. The tests ensure that JSON serialization/deserialization behavior remains stable, which will facilitate future migrations (e.g., to System.Text.Json) and model improvements. The PR also standardizes file headers and converts to file-scoped namespaces.

Key changes:

  • Added 9 new test files with comprehensive serialization/deserialization tests for all Manifest model classes
  • Converted 12 Manifest model files to use file-scoped namespaces
  • Updated .editorconfig to match the most common file header format across the codebase

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ImageBuilder/Models/Manifest/TagSyndication.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/TagDocumentationType.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Tag.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Repo.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Readme.cs Added missing third line to file header
src/ImageBuilder/Models/Manifest/Platform.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/OS.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Manifest.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Image.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/CustomBuildLegGroup.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/CustomBuildLegDependencyType.cs Converted to file-scoped namespace
src/ImageBuilder/Models/Manifest/Architecture.cs Converted to file-scoped namespace
src/ImageBuilder.Tests/Models/SerializationHelper.cs Added helper utilities for testing serialization behavior
src/ImageBuilder.Tests/Models/TagSyndicationSerializationTests.cs Added tests for TagSyndication serialization
src/ImageBuilder.Tests/Models/TagSerializationTests.cs Added tests for Tag serialization
src/ImageBuilder.Tests/Models/RepoSerializationTests.cs Added tests for Repo serialization
src/ImageBuilder.Tests/Models/ReadmeSerializationTests.cs Added tests for Readme serialization
src/ImageBuilder.Tests/Models/PlatformSerializationTests.cs Added tests for Platform serialization
src/ImageBuilder.Tests/Models/ManifestSerializationTests.cs Added tests for Manifest serialization
src/ImageBuilder.Tests/Models/ImageSerializationTests.cs Added tests for Image serialization
src/ImageBuilder.Tests/Models/CustomBuildLegGroupSerializationTests.cs Added tests for CustomBuildLegGroup serialization
src/ImageBuilder.Tests/GetStaleImagesCommandTests.cs Simplified type references by removing redundant namespace qualification
src/ImageBuilder.Models/Manifest.cs Added missing third line to file header
.editorconfig Updated file header template to match most common format in codebase

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lbussell
lbussell merged commit da30516 into dotnet:main Dec 19, 2025
@lbussell
lbussell deleted the serialization-tests branch December 19, 2025 22:25
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.

3 participants