Skip to content

feat: add expectations on Uri#782

Merged
vbreuss merged 2 commits intomainfrom
topic/add-uri-expectations
Sep 14, 2025
Merged

feat: add expectations on Uri#782
vbreuss merged 2 commits intomainfrom
topic/add-uri-expectations

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Sep 14, 2025

This PR introduces expectations for Uri objects in the aweXpect assertion library, adding fluent API methods for validating common Uri properties and characteristics.

Key changes:

  • Added Uri-specific assertion methods for absolute, file, loopback, and UNC path validation
    • ThatUri.Is{Not}Absolute()
    • ThatUri.Is{Not}File()
    • ThatUri.Is{Not}Loopback()
    • ThatUri.Is{Not}Unc()
  • Added port validation methods for checking default port usage
    • ThatUri.HasDefaultPort() / ThatUri.DoesNotHaveDefaultPort()
  • Enhanced source generator to support more flexible naming patterns

- `Is{Not}Absolute`
- `Is{Not}File`
- `Is{Not}Loopback`
- `Is{Not}Unc`
- `HasDefaultPort` / `DoesNotHaveDefaultPort`
@vbreuss vbreuss self-assigned this Sep 14, 2025
Copilot AI review requested due to automatic review settings September 14, 2025 06:15
@vbreuss vbreuss added the enhancement New feature or request label Sep 14, 2025
Copy link
Copy Markdown

Copilot AI left a comment

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 introduces expectations for Uri objects in the aweXpect assertion library, adding fluent API methods for validating common Uri properties and characteristics.

Key changes:

  • Added Uri-specific assertion methods for absolute, file, loopback, and UNC path validation
  • Added port validation methods for checking default port usage
  • Enhanced source generator to support more flexible naming patterns

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Tests/aweXpect.Tests/aweXpect.Tests.csproj.DotSettings Added namespace folder skip for uris test directory
Tests/aweXpect.Tests/Uris/*.cs Created comprehensive test suites for all new Uri assertion methods
Source/aweXpect/aweXpect.csproj.DotSettings Added namespace folder skip for uris source directory
Source/aweXpect/That/Uris/*.cs Implemented Uri assertion methods using source generator attributes
Source/aweXpect.SourceGenerators/*.cs Enhanced source generator to support custom positive/negative method names and expectation texts
Tests/aweXpect.Api.Tests/Expected/*.txt Updated API surface tests to include new ThatUri class
Source/aweXpect/That/Chars/ThatNullableChar.*.cs Fixed nullable char assertion implementations

@vbreuss vbreuss force-pushed the topic/add-uri-expectations branch from ab1655b to ba40319 Compare September 14, 2025 06:20
@vbreuss vbreuss enabled auto-merge (squash) September 14, 2025 06:22
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 14, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.414
[Host] : .NET 8.0.20 (8.0.2025.41914), X64 RyuJIT AVX2

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 230.2 ns 4.51 ns 4.22 ns 0.0300 - 504 B
Bool_FluentAssertions 252.1 ns 1.79 ns 1.67 ns 0.0567 - 952 B
Bool_TUnit 895.9 ns 6.36 ns 5.31 ns 0.1431 - 2408 B
Equivalency_aweXpect 299,413.5 ns 2,846.35 ns 2,662.48 ns 20.0195 0.9766 335556 B
Equivalency_FluentAssertions 2,301,245.3 ns 34,919.40 ns 32,663.63 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 705,313.0 ns 8,120.94 ns 7,596.33 ns 51.7578 2.9297 880545 B
Int_GreaterThan_aweXpect 249.2 ns 2.26 ns 2.00 ns 0.0486 - 816 B
Int_GreaterThan_FluentAssertions 247.8 ns 1.89 ns 1.68 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 1,218.1 ns 14.11 ns 13.20 ns 0.1774 - 2984 B
ItemsCount_AtLeast_aweXpect 480.2 ns 6.13 ns 5.74 ns 0.0873 - 1464 B
ItemsCount_AtLeast_FluentAssertions 501.5 ns 3.46 ns 3.24 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 14,759.7 ns 96.84 ns 80.86 ns 1.6327 - 27480 B
String_aweXpect 418.8 ns 1.82 ns 1.42 ns 0.0734 - 1232 B
String_FluentAssertions 471.1 ns 2.61 ns 2.31 ns 0.1292 - 2168 B
String_TUnit 1,259.4 ns 4.65 ns 4.12 ns 0.1831 - 3072 B
StringArray_aweXpect 1,815.4 ns 15.08 ns 14.10 ns 0.1717 - 2888 B
StringArray_FluentAssertions 1,378.2 ns 3.71 ns 3.29 ns 0.2480 - 4152 B
StringArray_TUnit 3,306.5 ns 14.75 ns 12.32 ns 0.3128 - 5296 B
StringArrayInAnyOrder_aweXpect 2,199.4 ns 9.53 ns 8.45 ns 0.1831 - 3080 B
StringArrayInAnyOrder_FluentAssertions 150,395.1 ns 257.27 ns 200.86 ns 3.4180 - 63351 B
StringArrayInAnyOrder_TUnit 3,886.9 ns 21.66 ns 20.26 ns 0.3815 - 6488 B

@github-actions
Copy link
Copy Markdown
Contributor

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

    14 files   -      1      14 suites   - 1   4m 7s ⏱️ +51s
17 917 tests +   559  17 915 ✅ +   560  2 💤 ±0  0 ❌  - 1 
50 418 runs  +16 909  50 416 ✅ +16 910  2 💤 ±0  0 ❌  - 1 

Results for commit ba40319. ± Comparison against base commit f68f8a1.

This pull request removes 1048 and adds 1607 tests. Note that renamed tests count towards both.
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message394648f7-f6b0-4e94-8978-097c73c54026")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message468670ee-5261-41e4-808d-1e7dc8ff5fca")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message896c862a-676b-446a-af69-14da13ff73cb")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message9402277f-93eb-481d-8c58-9497d6727cdf")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason262d10ba-b4a7-46f6-bfd2-4fedd7832346")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reasonfc0ee23a-07be-4207-a48d-9e16b6c1c65f")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reason2e19e66e-c8c8-44fd-9266-1098a5c928fb")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reasoned720dff-0bf7-47f4-be91-07062e782141")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: True, reason: "reasonae6e7409-4fc8-478b-91e7-c9ca93cf46b6")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: True, reason: "reasondabf0062-8941-4914-83cf-cb0343f78df3")
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message27f2c86f-8198-4ea1-aa85-ea11ca370b71")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message5fab13d2-2480-4db2-bbb8-d0d787352f14")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messagea0c48f75-441b-41a0-86e9-b21e1e687e5a")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message491696f7-0499-4e1b-aeb1-5f649058c248")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "message94677d57-534a-4a84-9013-816eb94887c0")
aweXpect.Core.Tests.Core.Exceptions.SkipExceptionTests ‑ Message_ShouldBeSet(message: "messagef1c69d81-5579-48d2-a481-fbf1fb22bbe2")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason40c902ca-1144-4afb-8398-b6d1dc7fcf11")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason6252e49a-5d35-4210-9e35-78726378f10f")
aweXpect.Core.Tests.FailTests ‑ Test_ShouldThrowException(reason: "reason82a54ed4-cad0-4f3a-811e-9c80d7d218ce")
aweXpect.Core.Tests.FailTests ‑ Unless_ShouldThrowException(condition: False, reason: "reason33f1aa50-baab-4a2a-83c4-6477a4b80cdd")
…

@vbreuss vbreuss disabled auto-merge September 14, 2025 06:30
@vbreuss vbreuss merged commit 70e516b into main Sep 14, 2025
14 checks passed
@vbreuss vbreuss deleted the topic/add-uri-expectations branch September 14, 2025 06:30
github-actions Bot added a commit that referenced this pull request Sep 14, 2025
github-actions Bot added a commit that referenced this pull request Sep 14, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.24.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants