Skip to content

Px file reading with Px.Utils#467

Draft
likp wants to merge 26 commits intomainfrom
feature/pxutils
Draft

Px file reading with Px.Utils#467
likp wants to merge 26 commits intomainfrom
feature/pxutils

Conversation

@likp
Copy link
Contributor

@likp likp commented Oct 30, 2025

No description provided.

likp and others added 23 commits October 10, 2025 09:39
…er. Made small changes to expose a seam to integrate the tests to. Fixed small issues found by the tests.
Introduced GroupRegistryWrapper to encapsulate GroupRegistry access and improve testability. Updated PxBuilder to use this wrapper, adding default groupings from the group registry to variables during model building. Enhanced ApplyGrouping to update variable values and handle language-specific logic when groupings are applied.
Refactored PxBuilder to properly restore original variables and update selections when groupings are applied. Implemented sum grouping operations after eliminations, added helper methods for variable substitution, and updated MatrixMap construction for groupings. Replaced TODOs with actual logic. PxFileBuilder2 now inherits from PXFileBuilder.
Replaced Assert.AreEqual checks on collection Count with Assert.HasCount in PxUtilsProxyParserTests.cs. This improves test readability and better expresses intent without altering test logic or data.
Moved ParseStringToList from PxUtilsProxyParser to new static FileProcessingUtils class for better code organization and reuse. Updated all references and removed the old implementation. Added comprehensive unit tests for ParseStringToList covering various input scenarios.
All variables now have codes for their values; fictional codes are assigned if missing. Introduced protected virtual GetStream() for customizable file access, replacing direct FileStream creation in BuildForPresentation.
Added PxBuilderTests to verify elimination by value and sum in PX files. Introduced EliminationPxFile fixture for test data. Made TestablePxUtilsProxyParser public for broader test accessibility.
Introduce GroupingFixtures for reusable test groupings and update PxBuilderTests to use these fixtures. Add comprehensive tests for grouping application, elimination, and aggregation, improving coverage of grouped variable handling in PxBuilder.
Updated PxBuilder to always add a content variable to PXMeta if missing, using the new ContentsUtil helper. Adjusted related tests to expect the content variable, and localized its name for all supported languages.
Refactored PxFileBuilder2 to delegate contents variable creation to ContentsUtil.AssertContentsVariableExists, reducing code duplication. Introduced UsePxUtilsParser option in PxFileConfigurationOptions to allow runtime selection between PxBuilder and PxFileBuilder2 in PxFileDataSource. Updated class inheritance and namespaces to align with new structure.
@likp likp linked an issue Feb 9, 2026 that may be closed by this pull request
6 tasks
likp added 3 commits February 9, 2026 16:23
Add explicit setups for GetConfiguration() on IPxFileConfigurationService mocks in PXDataSourceTest.cs to ensure consistent return of PxFileConfigurationOptions during tests. Also add a private Mock<T>() stub for future use. Improves test reliability and configuration mocking.
Changed logic so that when entryKey.SubKey is null, the handler receives null for subkey instead of an empty string. This allows the handler to distinguish between missing and empty subkeys.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

[TestMethod]
[DataRow(" abc ", "abc")]
[DataRow(" \"abc\" ", "abc")]
[DataRow("\"a\"b\"c\"", "a\"b\"c")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsaarimaa I just want to double check that this is a correct test case "a"b"c" should probably validate to abc and not a"b"c.

I am working on a fix for FileProcessingUtils.ParseStringToList we found yesterday after you have gone. The occured when you have a input that spans over multiple rows like

"Test Testsson, SCB#Tel: 08-111 222 33#Fax: 08-222 333 44#E-mail: test.testsson@sc"
"b.se##Test2 Testsson2, SCB#Tel: 08-333 444 55#Fax: 08-444 555 66#E-mail: test2.testsson2"
"@scb.se"

This should actually just translate to one line string, but the current implementation preserved the line breaks and commas.

The rule should is chunks between quotation marks should be concatenated with each other as one item if they are not separated by commas and white space between them should be removed. Therefor I think that "a"b"c" should be parsed to abc and not a"b"c. Any thoughts?

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.

Make PxWebApi work with Px.Utils

3 participants

Comments