You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs

36 lines
1.1 KiB

using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Volo.Abp.Settings
{
public class SettingProvider_Tests : AbpIntegratedTest<AbpSettingsTestModule>
{
private readonly ISettingProvider _settingProvider;
public SettingProvider_Tests()
{
_settingProvider = GetRequiredService<ISettingProvider>();
}
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
{
options.UseAutofac();
}
[Fact]
public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value()
{
(await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue))
.ShouldBeNull();
}
[Fact]
public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value()
{
(await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue))
.ShouldBe("default-value");
}
}
}