Skip to content

Epic: Establish Testable Core Architecture: Validation, Operations, and Serialization #64

@marcnoon

Description

@marcnoon

Goal:
Refactor the application architecture by isolating all business logic from the Windows Forms UI. This will create a stable, comprehensively tested foundation (OpNode.Core) essential for supporting a Free/Pro tiered business model.

Rationale:
The current tight coupling with WinForms prevents reliable unit testing. This Epic restructures the application to handle naming conventions, core operations (e.g., ulu:op="sum"), and robust bidirectional serialization (XML and JSON) in a decoupled, testable library.


Epic Roadmap and Sub-Issues

Phase 1: Architectural Decoupling and Naming Conventions

Issue 1.1: Setup OpNode.Core and Test Projects

  • Create OpNode.Core (Class Library) for business logic.
  • Create OpNode.Core.Tests (Unit Test Project).
  • Configure dependencies. CRITICAL: OpNode.Core must have NO dependency on System.Windows.Forms.
  • Define a base NamingValidator service and ValidationResult structure in Core.

Issue 1.2: Refactor and Test Namespace Validation

  • Implement NamingValidator.ValidateNamespace().
  • Write comprehensive unit tests for valid, invalid, reserved, and edge-case namespaces.
  • Refactor the WinForms UI (e.g., LeftRight control) to use the Core validator.

Issue 1.3: Refactor and Test Prefix Logic

  • Implement NamingValidator.ValidatePrefix().
  • Write unit tests covering standard and reserved prefixes.
  • Refactor the WinForms UI.

Issue 1.4: Define and Test Suffix/Versioning Logic

  • Implement NamingValidator.ValidateSuffix().
  • Write unit tests for suffix and versioning formats.
  • Refactor the WinForms UI.

Phase 2: Data Modeling and Core Operations

Issue 2.1: Define the PNode/OpNode Data Model (DTO)

  • Define the PNode class structure.
  • Ensure the model supports hierarchical structures, namespaces, prefixes, suffixes, and attributes.

Issue 2.2: Define Operation Schema and Abstractions (ulu:op)

  • Define an IOperation interface (or abstract class) with an Execute() method.
  • Create an OperationResolver or OperationFactory that maps the string identifier (e.g., "sum") to a concrete IOperation instance.

Issue 2.3: Implement and Test Basic Arithmetic Operations

  • Implement SumOperation, SubtractOperation, MultiplyOperation, and DivideOperation.
  • Write comprehensive unit tests for these operations, including edge cases (e.g., division by zero, overflow).

Phase 3: Serialization and Interoperability

Issue 3.1: Implement and Test XML Serialization Round-Tripping

  • Implement NodeXmlSerializer.
  • Ensure serialization correctly generates the required XML structure, including namespaces and attributes (e.g., <Node xmlns:ulu="..." ulu:op="sum" version="...">).
  • Write Round-Trip Tests: Serialize -> Deserialize -> Assert the resulting object is identical to the original.

Issue 3.2: Implement and Test JSON Serialization Round-Tripping

  • Define the JSON schema (deciding how to represent XML-like concepts such as ulu:op in JSON).
  • Implement NodeJsonSerializer (using System.Text.Json).
  • Write Round-Trip Tests for JSON.

Issue 3.3: Cross-Format Integrity Testing

  • Implement tests to verify that a PNode serialized to XML and the same PNode serialized to JSON can both be deserialized back into identical object structures.

This Epic will track the creation and progress of all sub-issues/tasks described above. Each sub-issue can be created as a separate GitHub issue and linked to this Epic for holistic tracking of architectural refactor and modernization.

Sub-issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions