-
Notifications
You must be signed in to change notification settings - Fork 0
upgrade to net9 #7
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Removed closing </Project> tag in API.csproj for structural adjustment. - Refactored Return200OkResponseHandler.cs to use C# 12/13 collection expression syntax and object initializers for better readability. - Updated SampleServiceTest.cs to use 'using' for HttpClient instantiation and added comments for clarity in test phases.
- Upgraded `Microsoft.NET.Test.Sdk` and added `Newtonsoft.Json` to `Client.Test.csproj`. - Added new test classes for `AuthenticationService`, `CRUDService`, `ErrorHandlingService`, and `FileUploadService`. - Refactored `CRUDService` to use dependency injection for `HttpClient`. - Introduced new services: `ConcurrencyService`, `CustomHeadersService`, `FileUploadService`, `GraphQLService`, and `WebhookService`. - Enhanced `AuthenticationService` with token authentication methods. - Updated `README.md` to include new features and usage examples.
- Updated `ci.yml` to add project validation and improve caching and artifact uploads. - Modified `code-quality.yml` to include code analysis and format checks. - Downgraded `Microsoft.NET.Test.Sdk` in `Client.Test.csproj` and replaced `xunit` with `xunit.v3`. - Introduced `GlobalUsings.cs` for global using directives in tests. - Created response handler files for specific HTTP responses in tests. - Refactored `SampleServiceTest.cs` with new tests and improved error handling. - Cleaned up `AuthenticationServiceTests.cs` and enhanced mock setups. - Improved mock handler setups and assertions in `CRUDServiceTests.cs`. - Enhanced error handling in `ErrorHandlingServiceTests.cs`. - Verified HTTP request creation in `FileUploadServiceTests.cs`. - Initialized `Name` and `Address` properties in `ContactViewModel.cs` to default to `string.Empty`.
- Improved dependency caching and added validation steps in `ci.yml`. - Enhanced code quality checks in `code-quality.yml` with dependency restoration and warning treatment. - Added CI and code quality badges to `README.md`. - Expanded documentation on Continuous Integration features and status. - Replaced outdated testing examples with a comprehensive overview of testing practices. - Updated project structure details in `README.md`. - Made minor language and formatting adjustments for clarity.
Moved `dotnet restore` into the `Check code formatting` step, removing the separate restore step for improved efficiency.
Updated `code-quality.yml` to add a job for code formatting using `dotnet format`. Enabled the `Nullable` feature in multiple project files to improve null safety. Removed the serialization constructor from `UnauthorizedApiAccessException`, which may impact exception handling during serialization. Overall, these changes aim to improve code quality and maintainability.
Updated the codebase to include 35 unit tests with comprehensive coverage for error handling and HTTP status codes using xUnit v3.0.1 and Moq. Introduced `PollyResilienceService` for resilience patterns like retry, circuit breaker, and timeout policies at the HttpClient level. Implemented `ProductionReadyHttpClientService` for best practices in logging, security, and monitoring. Added `PerformanceOptimizationService` to demonstrate high-throughput scenarios, including connection pooling and streaming. Provided educational custom handlers for retry and circuit breaker patterns, emphasizing the use of Polly in production. Updated appsettings.json for flexible API configurations and revised documentation to reflect new features and usage examples.
Revised the README title to "HttpClient .NET 9 Patterns & Best Practices". Enhanced the introduction to focus on comprehensive usage patterns, highlighting five approaches and Microsoft's recommended production patterns with Polly. Streamlined content for clarity, reorganized sections, and added details about learning outcomes and project structure to improve documentation and usability.
Enhanced the README.md to provide clearer guidance on HttpClient usage in .NET 9. Key updates include: - Expanded "What You'll Learn" section to cover various patterns. - Reformatted "Quick Start" for better readability. - Simplified headings and refined descriptions for each pattern. - Updated "Switching Between Patterns" for clarity on usage. - Reorganized "Complete Pattern Library" for better presentation. - Added notes on testing patterns and improved configuration examples. - Reformatted "Production Checklist" and "Anti-Patterns" for readability. - Clarified guidance on selecting appropriate patterns for applications. - Updated project structure section for better organization.
Updated tests across multiple service files to enhance HTTP response handling, error logging, and robustness. Modified `GetContactAsync` to return nullable types, standardized header casing in `CustomHeadersService`, and improved logging in `HttpCustomMessageHandlerService`. Added JSON validation in `PerformanceOptimizationService` and implemented try-catch blocks in `ProductionReadyHttpClientService` for better error management. Refactored `StreamService` for proper `HttpClient` initialization and memory efficiency during stream processing.
… timeout scenarios
…us reports after comprehensive analysis and fixes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the project's CI/CD pipeline, code quality enforcement, and .NET project configuration, alongside updates and enhancements to the unit tests for the
SampleService. The main changes focus on automating build, test, and validation processes, enforcing code quality and formatting standards, modernizing project settings, and improving the reliability and coverage of unit tests.CI/CD and Code Quality Automation
.github/workflows/ci.yml) that builds and tests across Ubuntu, Windows, and macOS, validates project structure, checks for required projects, ensures compilation, and runs security/vulnerability checks..github/workflows/code-quality.yml) that enforces build warnings as errors and verifies code formatting consistency usingdotnet format.Project Configuration and Dependency Updates
API/API.csprojandClient.Test/Client.Test.csproj. [1] [2]Client.Test/Client.Test.csprojto usexunit.v3, addedNewtonsoft.JsonandMicrosoft.Extensions.Http, and upgraded other packages for .NET 9 compatibility.Unit Test Enhancements and Coverage
Client.Test/SampleServiceTest.cs:Client.Test/HandlersStub/Return404NotFoundResponseHandler.cs) and updated the 200 OK handler to use modern C# syntax andNewtonsoft.Jsonserialization for more realistic test data. [1] [2]Codebase Modernization
These changes collectively improve the automation, reliability, and maintainability of the codebase, ensuring high code quality and robust test coverage as the project moves forward with .NET 9.