forked from ical-org/ical.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Refactor CalDateTime and DateTimeSerializer
* Introduced new methods and test cases in `CalDateTimeTests.cs` to ensure correct behavior of `CalDateTime` properties and methods. * Updated various tests in `DeserializationTests.cs` and `RecurrenceTests.cs` to handle `CalDateTime` without time components and improve clarity. * Refined `IsAllDay` property in `CalendarEvent.cs` and updated methods in `UniqueComponent.cs` and `VTimeZone.cs` to use `CalDateTime` with time components. * Removed outdated comments and improved code formatting. * Enabled nullable reference types and updated `IDateTime` interface. * Added new methods and properties to `CalDateTime.cs` for better date and time management. * Refactored methods in `Period`, `RecurrencePatternEvaluator`, and `RecurringEvaluator` classes to handle `HasTime` property correctly. * Improved `DateTimeSerializer` class for better performance and handling of nullable types. * Added XML documentation and marked obsolete methods. Resolves ical-org#630 Resolves ical-org#633 Resolves ical-org#635 Resolves ical-org#636 Resolves ical-org#637
- Loading branch information
Showing
18 changed files
with
721 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,22 +448,13 @@ public void Transparency2() | |
Assert.That(evt.Transparency, Is.EqualTo(TransparencyType.Transparent)); | ||
} | ||
|
||
/// <summary> | ||
/// Tests that DateTime values that are out-of-range are still parsed correctly | ||
/// and set to the closest representable date/time in .NET. | ||
/// </summary> | ||
[Test] | ||
public void DateTime1() | ||
public void DateTime1_Unrepresentable_DateTimeArgs_ShouldThrow() | ||
{ | ||
var iCal = Calendar.Load(IcsFiles.DateTime1); | ||
Assert.That(iCal.Events, Has.Count.EqualTo(6)); | ||
|
||
var evt = iCal.Events["[email protected]"]; | ||
Assert.That(evt, Is.Not.Null); | ||
|
||
// The "Created" date is out-of-bounds. It should be coerced to the | ||
// closest representable date/time. | ||
Assert.That(evt.Created.Value, Is.EqualTo(DateTime.MinValue)); | ||
Assert.That(() => | ||
{ | ||
_ = Calendar.Load(IcsFiles.DateTime1); | ||
}, Throws.Exception.TypeOf<ArgumentOutOfRangeException>()); | ||
} | ||
|
||
[Test] | ||
|
Oops, something went wrong.