Add project files.
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
using Elsa.Common.Models;
|
||||
using Elsa.Workflows.ComponentTests.Abstractions;
|
||||
using Elsa.Workflows.ComponentTests.Fixtures;
|
||||
using Elsa.Workflows.Management;
|
||||
using Elsa.Workflows.Management.Filters;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Elsa.Workflows.ComponentTests.Scenarios.Multitenancy;
|
||||
|
||||
public class MultitenancyTests(App app) : AppComponentTest(app)
|
||||
{
|
||||
[Fact(Skip = "Multitenancy disabled. This test doesn't work because not all workflows are assigned the Tenant1 tenant.")]
|
||||
public async Task LoadingWorkflows_ShouldReturnWorkflows_FromCurrentTenant()
|
||||
{
|
||||
var store = Scope.ServiceProvider.GetRequiredService<IWorkflowDefinitionStore>();
|
||||
var filter = new WorkflowDefinitionFilter
|
||||
{
|
||||
IsSystem = false,
|
||||
VersionOptions = VersionOptions.Latest
|
||||
};
|
||||
var workflows = await store.FindManyAsync(filter);
|
||||
Assert.All(workflows, workflow => Assert.Equal("Tenant1", workflow.TenantId));
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using Elsa.Workflows.Activities;
|
||||
using Hangfire.Annotations;
|
||||
|
||||
namespace Elsa.Workflows.ComponentTests.Scenarios.Multitenancy.Workflows;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class WorkflowForTenant1 : WorkflowBase
|
||||
{
|
||||
public static readonly string DefinitionId = Guid.NewGuid().ToString();
|
||||
protected override void Build(IWorkflowBuilder builder)
|
||||
{
|
||||
builder.WithDefinitionId(DefinitionId);
|
||||
builder.WithTenantId("Tenant1");
|
||||
builder.Root = new WriteLine("Tenant1");
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using Elsa.Workflows.Activities;
|
||||
using Hangfire.Annotations;
|
||||
|
||||
namespace Elsa.Workflows.ComponentTests.Scenarios.Multitenancy.Workflows;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class WorkflowForTenant2 : WorkflowBase
|
||||
{
|
||||
public static readonly string DefinitionId = Guid.NewGuid().ToString();
|
||||
protected override void Build(IWorkflowBuilder builder)
|
||||
{
|
||||
builder.WithDefinitionId(DefinitionId);
|
||||
builder.WithTenantId("Tenant2");
|
||||
builder.Root = new WriteLine("Tenant2");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user