elsa-core/test/integration/Elsa.Core.IntegrationTests/Autofixture/WithSqliteYesSqlAttribute.cs
Craig Fowler d285b8b505 WIP composing customize attributes
This isn't really related to #751 - it's a refactor of some of
our test logic, to avoid bloat of semi-repeated autofixture
customization attributes.

By switching to a behaviour-driven model, it's possible to
compose them, which means that there's no need to part-duplicate
between them.  It should also reduce the overall number of them,
as combinations can be put together on-demand, rather than needing
a new attribute of their own.
2021-04-02 11:12:21 +01:00

25 lines
818 B
C#

using Elsa.Testing.Shared.Helpers;
using Elsa.Testing.Shared.AutoFixture.Attributes;
using System;
using Elsa.Persistence.YesSql;
using YesSql.Provider.Sqlite;
using System.Data;
namespace Elsa.Core.IntegrationTests.Autofixture
{
public class WithSqliteYesSqlAttribute : ElsaHostBuilderBuilderCustomizeAttributeBase
{
public override Action<ElsaHostBuilderBuilder> GetBuilderCustomizer()
{
var tempFolder = new TemporaryFolder();
return builder => {
builder.ElsaCallbacks.Add(elsa => {
elsa.UseYesSqlPersistence(config => {
config.UseSqLite($"Data Source={tempFolder.GetContainedPath("elsa.db")};", IsolationLevel.ReadUncommitted);
});
});
};
}
}
}