Files
Umbraco-CMS/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/NCronTabParserTests.cs
Paul Johnson 00133e880d 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>
2021-10-18 08:14:04 +01:00

36 lines
1.3 KiB
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration
{
[TestFixture]
public class NCronTabParserTests
{
private ICronTabParser Sut => new NCronTabParser();
[TestCase("", ExpectedResult = false)]
[TestCase("* * * * 1", ExpectedResult = true)]
[TestCase("* * * * * 1", ExpectedResult = false)]
[TestCase("* * * 1", ExpectedResult = false)]
[TestCase("Invalid", ExpectedResult = false)]
[TestCase("I n v a l", ExpectedResult = false)]
[TestCase("23 0-20/2 * * *", ExpectedResult = true)]
[TestCase("5 4 * * sun", ExpectedResult = true)]
[TestCase("0 0,12 1 */2 *", ExpectedResult = true)]
[TestCase("0 0 1,15 * 3", ExpectedResult = true)]
[TestCase("5 0 * 8 *", ExpectedResult = true)]
[TestCase("22 * * 1-5 *", ExpectedResult = true)]
[TestCase("23 0-20/2 * * *", ExpectedResult = true)]
[TestCase("23 0-20/2 * * sun-sat", ExpectedResult = true)]
[TestCase("23 0-20/2 * jan-dec sun-sat", ExpectedResult = true)]
[TestCase("* * 32 * *", ExpectedResult = false)]
public bool IsValidCronTab(string input)
{
return Sut.IsValidCronTab(input);
}
}
}