Ensures date comparisons in schedule integration tests are made only on the datetime part to the second (#18894)

* Ensures date comparisons in schedule integration tests are made only on the date part.

* Include time part to the second.

* Ensure Kind is retained when truncating a date.

* Retain Kind for all truncation levels.
This commit is contained in:
Andy Butland
2025-04-01 09:06:24 +02:00
committed by Jacob Overgaard
parent fc815db80b
commit 1720692d3d
2 changed files with 17 additions and 9 deletions

View File

@@ -1,4 +1,3 @@
using Bogus.DataSets;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
@@ -23,8 +22,8 @@ public class ContentPublishingServiceTests : UmbracoIntegrationTestWithContent
{
private const string UnknownCulture = "ke-Ke";
private readonly DateTime _schedulePublishDate = DateTime.UtcNow.AddDays(1);
private readonly DateTime _scheduleUnPublishDate = DateTime.UtcNow.AddDays(2);
private readonly DateTime _schedulePublishDate = DateTime.UtcNow.AddDays(1).TruncateTo(DateTimeExtensions.DateTruncate.Second);
private readonly DateTime _scheduleUnPublishDate = DateTime.UtcNow.AddDays(2).TruncateTo(DateTimeExtensions.DateTruncate.Second);
[SetUp]
public new void Setup() => ContentRepositoryBase.ThrowOnWarning = true;