chore: increase the amount of unit testing#5
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
===========================================
+ Coverage 55.51% 97.82% +42.30%
===========================================
Files 180 164 -16
Lines 8410 5556 -2854
Branches 1377 995 -382
===========================================
+ Hits 4669 5435 +766
+ Misses 3324 30 -3294
+ Partials 417 91 -326 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request significantly increases unit test coverage for the ReactiveUI.Binding library by adding comprehensive tests for type converters and updating the testing infrastructure. The changes focus on testing the binding framework's type conversion capabilities while ensuring that generated code is properly excluded from code coverage analysis.
Changes:
- Added unit tests for 14 type converter classes covering DateTime, DateTimeOffset, DateOnly, TimeOnly, TimeSpan, Guid, Boolean, and Double conversions
- Refactored test assembly initialization from
ModuleInitializerto[Before(Assembly)]pattern - Updated generated code to exclude from code coverage via
[ExcludeFromCodeCoverage]attribute
Reviewed changes
Copilot reviewed 300 out of 386 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| StringToDateTimeTypeConverterTests.cs | Tests string-to-DateTime conversion scenarios |
| StringToDateTimeOffsetTypeConverterTests.cs | Tests string-to-DateTimeOffset conversion scenarios |
| StringToDateOnlyTypeConverterTests.cs | Tests string-to-DateOnly conversion for .NET 6+ |
| NullableTimeSpanToStringTypeConverterTests.cs | Tests nullable TimeSpan-to-string conversion |
| NullableTimeOnlyToStringTypeConverterTests.cs | Tests nullable TimeOnly-to-string conversion for .NET 6+ |
| NullableGuidToStringTypeConverterTests.cs | Tests nullable Guid-to-string conversion |
| NullableDoubleToDoubleTypeConverterTests.cs | Tests nullable double-to-double conversion |
| NullableDateTimeToStringTypeConverterTests.cs | Tests nullable DateTime-to-string conversion |
| NullableDateTimeOffsetToStringTypeConverterTests.cs | Tests nullable DateTimeOffset-to-string conversion |
| NullableDateOnlyToStringTypeConverterTests.cs | Tests nullable DateOnly-to-string conversion for .NET 6+ |
| NullableBooleanToStringTypeConverterTests.cs | Tests nullable boolean-to-string conversion |
| GuidToStringTypeConverterTests.cs | Tests Guid-to-string conversion |
| DoubleToNullableDoubleTypeConverterTests.cs | Tests double-to-nullable double conversion |
| DateTimeToStringTypeConverterTests.cs | Tests DateTime-to-string conversion |
| DateTimeOffsetToStringTypeConverterTests.cs | Tests DateTimeOffset-to-string conversion |
| DateOnlyToStringTypeConverterTests.cs | Tests DateOnly-to-string conversion for .NET 6+ |
| BooleanToStringTypeConverterTests.cs | Tests boolean-to-string conversion |
| AssemblySetup.cs (multiple files) | Refactored test initialization to use [Before(Assembly)] |
| RxBindingExtensions.cs | Renamed from ObservableExtensions and added code coverage exclusion |
| BindingGenerator.cs | Added [ExcludeFromCodeCoverage] attribute generation for generated bindings |
| Various generator tests | Updated verified snapshots to include [ExcludeFromCodeCoverage] attribute |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/ReactiveUI.Binding.SourceGenerators/CodeGeneration/WhenAnyObservableCodeGenerator.cs
Show resolved
Hide resolved
Improve coverage tests
This pull request makes two main changes to the ReactiveUI.Binding source generators: it updates the generated binding code to use
RxBindingExtensionsinstead ofObservableExtensionsfor observable operations, and it ensures that generated binding classes are excluded from code coverage analysis. These changes help with code clarity, maintainability, and test reporting.Generated code improvements:
global::ReactiveUI.Binding.Observables.RxBindingExtensionsinstead ofObservableExtensionsfor observable operations such asSelect,Subscribe,Skip,Merge,Switch, andDistinctUntilChangedin the source generator output. This affects the code generation for one-way, two-way, and observation bindings. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]Code coverage improvements:
[ExcludeFromCodeCoverage]attribute to theReactiveSchedulerExtensionsclass and to a new generated partial class__ReactiveUIGeneratedBindings, ensuring that generated binding code is not included in code coverage metrics. [1] [2]