Skip to content

Develop - #331

Merged
JeffreySu merged 8 commits into
masterfrom
Develop
Sep 6, 2025
Merged

JeffreySu merged 8 commits into
masterfrom
Develop

Conversation

@JeffreySu

Copy link
Copy Markdown
Contributor

No description provided.

feat: Add async XML methods and improve stream handling

Added async methods `ConvertAsync` and `SerializerAsync<T>` in
`XmlUtility.cs` for XML processing, with support for cancellation
and stream handling via the `closeInput` parameter. Updated
`Deserialize<T>` and `Convert` methods for better parameter
formatting and added `closeInput` control.

In `XmlUtilityTests.cs`, added `ConvertAsyncTest` to validate
async XML conversion. Adjusted code formatting for consistency.
Refactored `DataOperationTests.cs`:
- Added `using System.Threading;` and `using System.Collections.Generic;`.
- Enabled APM in the constructor with `Senparc.CO2NET.APM.Config.EnableAPM = true;`.
- Fixed `BuildTestData` by appending `.Wait()` to ensure task completion.
- Commented out "Visitor Volume" related assertions in `SetAndGetTest` and `ReadAndCleanDataItemsTest`.
- Commented out "Visitor Volumn" (typo) related assertions in another test.

Updated `DataOperation.cs`:
- Added async cache retrieval logic in `GetDataItemListAsync` using `cacheStragety.GetAsync<List<DataItem>>`.

These changes focus on test adjustments and improving async data handling.
Refactored test methods to support async operations, improving code readability and efficiency.
Introduced a flexible caching strategy with dependency injection in `DataOperation.cs`.
Updated Redis configuration to use `10.37.129.2:6379` and centralized its management.
Added `CanUseRedis` method in `RedisManager.cs` for Redis availability checks.
Enhanced code reusability by introducing `SetRedis` method for Redis setup in multiple test files.
Replaced hardcoded Redis connection strings with a configurable `DefaultDomain` property.
Removed redundant code and improved code formatting across multiple files.
Updated project files to support the latest C# features and ensured consistency in test cases.
Replaced `await` with `_=` in `BuildTestDataAsync` to trigger
`SetAsync` without waiting, improving performance. Added
`Thread.Sleep(1000)` at the method's end to ensure async
operations complete and data is cached. Removed cache-related
debugging code from `SetAndGetTest`, retaining core data
operation assertions.
@JeffreySu
JeffreySu requested a review from Copilot September 6, 2025 15:41

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 XML serialization capabilities by adding asynchronous methods and improving cache module configuration for Redis connections across tests.

  • Adds async serialization methods to XmlUtility with proper cancellation token support
  • Consolidates Redis configuration setup through reusable helper methods in test files
  • Updates version numbers across multiple project files

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Senparc.CO2NET/Utilities/XmlUtility/XmlUtility.cs Adds async XML serialization methods and improves stream handling with closeInput parameter
src/Senparc.CO2NET.Tests/Utilities/XmlUtility/XmlUtilityTets.cs Adds async test for XML conversion functionality
src/Senparc.CO2NET.Cache.CsRedis/RedisManager.cs Adds CanUseRedis method for Redis connection validation
src/Senparc.CO2NET.APM/DataOperation.cs Refactors to accept custom cache strategy in constructor
Multiple test files Consolidates Redis configuration setup through helper methods
Multiple project files Updates version numbers for new release

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

JeffreySu and others added 3 commits September 6, 2025 23:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JeffreySu
JeffreySu merged commit b34b48c into master Sep 6, 2025
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.

2 participants