99 lines
2.3 KiB
C#
99 lines
2.3 KiB
C#
using Omika.Data.Configuration;
|
|
|
|
namespace Omika.Tests.Connection;
|
|
|
|
public class E2EOptionsTests
|
|
{
|
|
[Fact]
|
|
public void AllowHfSqlWrites_Default_IsFalse()
|
|
{
|
|
var options = new E2EOptions();
|
|
|
|
Assert.False(options.AllowHfSqlWrites);
|
|
}
|
|
|
|
[Fact]
|
|
public void ServiceDatabaseConfirmedTest_Default_IsFalse()
|
|
{
|
|
var options = new E2EOptions();
|
|
|
|
Assert.False(options.ServiceDatabaseConfirmedTest);
|
|
}
|
|
|
|
[Fact]
|
|
public void WebServiceDatabaseConfirmedTest_Default_IsFalse()
|
|
{
|
|
var options = new E2EOptions();
|
|
|
|
Assert.False(options.WebServiceDatabaseConfirmedTest);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsWriteAllowed_AllFlagsFalse_IsFalse()
|
|
{
|
|
var options = new E2EOptions();
|
|
|
|
Assert.False(options.IsWriteAllowed);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsWriteAllowed_OnlyAllowWrites_IsFalse()
|
|
{
|
|
var options = new E2EOptions { AllowHfSqlWrites = true };
|
|
|
|
Assert.False(options.IsWriteAllowed);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsWriteAllowed_OnlyServiceConfirmed_IsFalse()
|
|
{
|
|
var options = new E2EOptions { ServiceDatabaseConfirmedTest = true };
|
|
|
|
Assert.False(options.IsWriteAllowed);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsWriteAllowed_OnlyWebServiceConfirmed_IsFalse()
|
|
{
|
|
var options = new E2EOptions { WebServiceDatabaseConfirmedTest = true };
|
|
|
|
Assert.False(options.IsWriteAllowed);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsWriteAllowed_AllFlagsTrue_IsTrue()
|
|
{
|
|
var options = new E2EOptions
|
|
{
|
|
AllowHfSqlWrites = true,
|
|
ServiceDatabaseConfirmedTest = true,
|
|
WebServiceDatabaseConfirmedTest = true
|
|
};
|
|
|
|
Assert.True(options.IsWriteAllowed);
|
|
}
|
|
|
|
[Fact]
|
|
public void SectionName_IsE2E()
|
|
{
|
|
Assert.Equal("E2E", E2EOptions.SectionName);
|
|
}
|
|
|
|
[Fact]
|
|
public void ToString_DoesNotExposeSecrets()
|
|
{
|
|
var options = new E2EOptions
|
|
{
|
|
AllowHfSqlWrites = true,
|
|
ServiceDatabaseConfirmedTest = true,
|
|
WebServiceDatabaseConfirmedTest = true
|
|
};
|
|
|
|
var text = options.ToString();
|
|
|
|
Assert.Contains("AllowHfSqlWrites = True", text);
|
|
Assert.Contains("ServiceDatabaseConfirmedTest = True", text);
|
|
Assert.Contains("WebServiceDatabaseConfirmedTest = True", text);
|
|
}
|
|
}
|