Move test projects from src/ to tests/ (#11357)

* Update gitignore

* Move csproj

* Update project references

* Update solutions

* Update build scripts

* Tests used to share editorconfig with projects in src

* Fix broken tests.

* Stop copying around .editorconfig

merged root one with linting

* csharp_style_expression_bodied -> suggestion

* Move StyleCop rulesets to matching directories and update shared build properties

* Remove legacy build files, update NuGet.cofig and solution files

* Restore myget source

* Clean up .gitignore

* Update .gitignore

* Move new test classes to tests after merge

* Gitignore + nuget config

* Move new test

Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
Paul Johnson
2021-10-18 08:14:04 +01:00
committed by GitHub
parent c005673a96
commit 00133e880d
752 changed files with 650 additions and 1844 deletions

View File

@@ -0,0 +1,51 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models.Extensions
{
[TestFixture]
public class HealthCheckSettingsExtensionsTests
{
private ICronTabParser CronTabParser => new NCronTabParser();
[TestCase("30 12 * * *", 30)]
[TestCase("15 18 * * *", (60 * 6) + 15)]
[TestCase("0 3 * * *", 60 * 15)]
[TestCase("0 3 2 * *", (24 * 60 * 1) + (60 * 15))]
[TestCase("0 6 * * 3", (24 * 60 * 3) + (60 * 18))]
public void Returns_Notification_Delay_From_Provided_Time(string firstRunTimeCronExpression, int expectedDelayInMinutes)
{
var settings = new HealthChecksSettings
{
Notification = new HealthChecksNotificationSettings
{
FirstRunTime = firstRunTimeCronExpression,
}
};
var now = new DateTime(2020, 10, 31, 12, 0, 0);
TimeSpan result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.Zero);
Assert.AreEqual(expectedDelayInMinutes, result.TotalMinutes);
}
[Test]
public void Returns_Notification_Delay_From_Default_When_Provided_Time_Too_Close_To_Current_Time()
{
var settings = new HealthChecksSettings
{
Notification = new HealthChecksNotificationSettings
{
FirstRunTime = "30 12 * * *",
}
};
var now = new DateTime(2020, 10, 31, 12, 25, 0);
TimeSpan result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.FromMinutes(10));
Assert.AreEqual(10, result.TotalMinutes);
}
}
}