V9: Fix Umbraco:CMS:Global:SqlWriteLockTimeOut setting value ignored (#11492)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using System;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
@@ -15,7 +16,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validati
|
||||
public void Returns_Success_ForValid_Configuration()
|
||||
{
|
||||
var validator = new GlobalSettingsValidator();
|
||||
GlobalSettings options = BuildGlobalSettings();
|
||||
var options = new GlobalSettings();
|
||||
ValidateOptionsResult result = validator.Validate("settings", options);
|
||||
Assert.True(result.Succeeded);
|
||||
}
|
||||
@@ -24,18 +25,55 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validati
|
||||
public void Returns_Fail_For_Configuration_With_Invalid_SmtpFrom_Field()
|
||||
{
|
||||
var validator = new GlobalSettingsValidator();
|
||||
GlobalSettings options = BuildGlobalSettings(smtpEmail: "invalid");
|
||||
var options = new GlobalSettings
|
||||
{
|
||||
Smtp = new SmtpSettings
|
||||
{
|
||||
From = "invalid",
|
||||
}
|
||||
};
|
||||
|
||||
ValidateOptionsResult result = validator.Validate("settings", options);
|
||||
Assert.False(result.Succeeded);
|
||||
}
|
||||
|
||||
private static GlobalSettings BuildGlobalSettings(string smtpEmail = "test@test.com") =>
|
||||
new GlobalSettings
|
||||
[Test]
|
||||
public void Returns_Fail_For_Configuration_With_Insufficient_SqlWriteLockTimeOut()
|
||||
{
|
||||
var validator = new GlobalSettingsValidator();
|
||||
var options = new GlobalSettings
|
||||
{
|
||||
Smtp = new SmtpSettings
|
||||
{
|
||||
From = smtpEmail,
|
||||
}
|
||||
SqlWriteLockTimeOut = TimeSpan.Parse("00:00:00.099")
|
||||
};
|
||||
|
||||
ValidateOptionsResult result = validator.Validate("settings", options);
|
||||
Assert.False(result.Succeeded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Returns_Fail_For_Configuration_With_Excessive_SqlWriteLockTimeOut()
|
||||
{
|
||||
var validator = new GlobalSettingsValidator();
|
||||
var options = new GlobalSettings
|
||||
{
|
||||
SqlWriteLockTimeOut = TimeSpan.Parse("00:00:21")
|
||||
};
|
||||
|
||||
ValidateOptionsResult result = validator.Validate("settings", options);
|
||||
Assert.False(result.Succeeded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Returns_Success_For_Configuration_With_Valid_SqlWriteLockTimeOut()
|
||||
{
|
||||
var validator = new GlobalSettingsValidator();
|
||||
var options = new GlobalSettings
|
||||
{
|
||||
SqlWriteLockTimeOut = TimeSpan.Parse("00:00:20")
|
||||
};
|
||||
|
||||
ValidateOptionsResult result = validator.Validate("settings", options);
|
||||
Assert.True(result.Succeeded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user