Added unit tests for introduced unit test configuration setting builders.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Net.Mail;
|
||||
using Umbraco.Core.Configuration.Models.Validation;
|
||||
|
||||
@@ -16,7 +17,18 @@ namespace Umbraco.Core.Configuration.Models
|
||||
|
||||
public string PickupDirectoryLocation { get; set; }
|
||||
|
||||
public SmtpDeliveryMethod DeliveryMethod { get; set; }
|
||||
// See notes on ContentSettings.MacroErrors
|
||||
internal string DeliveryMethod { get; set; }
|
||||
|
||||
public SmtpDeliveryMethod DeliveryMethodValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return Enum.TryParse<SmtpDeliveryMethod>(DeliveryMethod, true, out var value)
|
||||
? value
|
||||
: SmtpDeliveryMethod.Network;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net.Mail;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Models.Validation
|
||||
{
|
||||
@@ -17,7 +18,8 @@ namespace Umbraco.Core.Configuration.Models.Validation
|
||||
|
||||
private bool ValidateSmtpSetting(SmtpSettings value, out string message)
|
||||
{
|
||||
return ValidateOptionalEntry("Global:Smtp", value, "A valid From email address is required", out message);
|
||||
return ValidateOptionalEntry("Global:Smtp", value, "A valid From email address is required", out message) &&
|
||||
ValidateStringIsOneOfEnumValues("Global:Smtp:DeliveryMethod", value.DeliveryMethod, typeof(SmtpDeliveryMethod), out message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user