Skip to content

Conversation

@axunonb
Copy link
Collaborator

@axunonb axunonb commented Apr 10, 2025

  • Updated the Duration struct for improved argument validation and error messaging
  • Added new test cases in AlarmTest.cs for DurationSerializer to validate various duration formats and handle invalid arguments.

Fixes #766

@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
....Net/Serialization/DataTypes/DurationSerializer.cs 33% 2 Missing ⚠️

❌ Your project status has failed because the head coverage (67%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #767   +/-   ##
===================================
  Coverage    67%    67%           
===================================
  Files       104    104           
  Lines      4494   4499    +5     
  Branches   1113   1113           
===================================
+ Hits       2996   3003    +7     
+ Misses     1068   1066    -2     
  Partials    430    430           
Files with missing lines Coverage Δ
Ical.Net/DataTypes/Duration.cs 77% <100%> (+7%) ⬆️
....Net/Serialization/DataTypes/DurationSerializer.cs 86% <33%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@axunonb axunonb marked this pull request as ready for review April 10, 2025 22:37
@axunonb axunonb requested a review from minichma April 10, 2025 22:37
@axunonb axunonb force-pushed the axunonb/wip/pr/fix-issue-766 branch from 2e01d65 to 85bb993 Compare April 11, 2025 11:58
@axunonb axunonb force-pushed the axunonb/wip/pr/fix-issue-766 branch from 85bb993 to b2bd9f6 Compare April 11, 2025 15:19
minichma
minichma previously approved these changes Apr 11, 2025
[TestCase("-P0DT0H30M0S", 0, 0, 0, -30, 0)]
[TestCase("-P1DT1H", 0, -1, -1, 0, 0)]
[TestCase("P", null, null, null, null, null)] // Empty duration
[TestCase("PT", null, null, null, null, null)] // Empty time
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this legal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

P and PT are not, I'll remove it for clarity

@minichma
Copy link
Collaborator

Great! Thank you for fixing this!

* Updated the `Duration` to identify the expected sign for args correctly
* Added new test cases for `DurationSerializer` to validate various duration formats and handle invalid arguments.

Fixes #766
@sonarqubecloud
Copy link

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.

FormatException with TRIGGER:-P0DT0H30M0S in VALARM

3 participants