Skip to content

[Tests] Domain models: validation tests (#106)#108

Merged
fboucher merged 1 commit into
v-nextfrom
squad/106-domain-model-validation-tests
Apr 1, 2026
Merged

[Tests] Domain models: validation tests (#106)#108
fboucher merged 1 commit into
v-nextfrom
squad/106-domain-model-validation-tests

Conversation

@fboucher

@fboucher fboucher commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Replaces property-setter tests with meaningful validation tests for Post, PostL, Settings, and Summary domain models.

Changes

Post & PostL

  • Test required field enforcement (PartitionKey, RowKey)
  • Test nullable boolean states (is_read)
  • Test default values (Word_count defaults to 0)
  • Test empty string support where applicable

Settings

  • Test ContainsPlaceholder validation attribute for SummaryPrompt and SearchPrompt
  • Test required placeholder presence ({content}, {topic})
  • Test null handling in validation
  • Test required fields

Summary

  • Test required fields (PartitionKey, RowKey)
  • Test nullable field behavior
  • Test string boolean values for IsGenerated

Impact

  • Removed 8 trivial property-setter tests
  • Added 22 validation and constraint tests
  • Tests now document actual model invariants
  • All 115 tests pass

Closes #106

@fboucher

fboucher commented Apr 1, 2026

Copy link
Copy Markdown
Owner Author

✅ APPROVED — Merge as-is

Review Summary

All acceptance criteria from issue #106 are fully met. This PR successfully transforms trivial property-setter tests into meaningful validation tests that document actual domain invariants.

Coverage Analysis

✅ Domain Model Validation Tests

  • 22 new tests covering Post, PostL, Settings, and Summary
  • Removed 8 trivial property-setter tests
  • All tests are genuinely meaningful (not just renamed setters)

✅ ContainsPlaceholder Validation

  • Settings.SummaryPrompt: Tests for required {content} placeholder (3 tests)
  • Settings.SearchPrompt: Tests for required {topic} placeholder (3 tests)
  • Uses proper validation framework with ValidationContext

✅ Required Field Enforcement

  • Tests for PartitionKey/RowKey on all 4 models (8 tests total)
  • Verifies C# required modifier enforcement

✅ Nullable Field Behavior

  • Post/PostL is_read: Tri-state boolean tests (null/true/false)
  • Summary nullable fields: IsGenerated, FileName, PublishedURL
  • Theory-based parameterized tests where appropriate

✅ Default Values

  • Post.Word_count defaults to 0 ✓
  • Nullable booleans default to null ✓

✅ CI Status

All 115 tests pass. Both CI checks successful:

  • .NET Tests: ✓
  • Run Unit Tests: ✓

Code Quality

  • Clear, descriptive test names
  • Proper use of FluentAssertions
  • Comprehensive edge case coverage
  • Well-structured AAA pattern

No gaps identified. Ready to merge.


Review by Livingston (Code Review Specialist)
Full report: .squad/decisions/inbox/livingston-pr108-review.md

@fboucher
fboucher changed the base branch from main to v-next April 1, 2026 11:11
- Post: test required fields, nullable states, default values
- PostL: test required fields, empty string support, boolean states
- Settings: test ContainsPlaceholder validation for prompts, required fields
- Summary: test required fields, nullable fields, string boolean values

Removed trivial property-only tests that don't catch regressions.
Added tests that document model constraints and validate business rules.

Closes #106

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fboucher
fboucher force-pushed the squad/106-domain-model-validation-tests branch from f8c1365 to 6f0a9ce Compare April 1, 2026 11:23
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
NoteBookmark.AIServices 97% 64%
NoteBookmark.Domain 5% 9%
NoteBookmark.Api 91% 80%
NoteBookmark.ServiceDefaults 96% 75%
NoteBookmark.Domain 83% 72%
NoteBookmark.AIServices 97% 64%
NoteBookmark.Domain 5% 9%
Summary 55% (919 / 1435) 39% (193 / 355)

@fboucher
fboucher merged commit ad06a85 into v-next Apr 1, 2026
3 checks passed
@fboucher
fboucher deleted the squad/106-domain-model-validation-tests branch April 1, 2026 11:47
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.

[Tests] Domain models — replace property-setter tests with validation tests (Post, PostL, Settings, Summary)

1 participant