Skip to content

Testing with In-Memory Databases in main Elsa docs references non-existent UseInMemory() method #150

@pruinsure

Description

@pruinsure

I am currently engaged with a spike for our company's usage of Elsa. Part of that is BDD style integration tests. Currently I'm attempting to utilize the in memory testing laid out in Testing with In-Memory Databases, to prove a bare minimum viable testing strategy. Unfortunately the InMemoryTestBase code given on the docs currently does not compile on my machine.

Is there an implementation of the EFCoreWorkflowDefinitionPersistenceFeature.UseInMemory() somewhere else?

I have attempted to set out repro steps, by following the documentation and a few steps I have attempted beyond that, and noting those down. This was performed with a brand new test project, with no dependencies other than those in the steps below.

Setup project and add packages

dotnet new xunit -n "MyWorkflows.Tests"
cd MyWorkflows.Tests
dotnet add package Elsa
dotnet add package Elsa.Testing.Shared
dotnet add package Microsoft.Extensions.DependencyInjection
dotnet add package xunit
dotnet add package xunit.runner.visualstudio

Configure Test Infrastructure

AS per setup test project - does not compile:
Services.PopulateRegistriesAsync does not sexist
Elsa.Workflows.Contracts - Contracts NS missing

Install memory integration tests required packages

dotnet add package Elsa.Testing.Shared.Integration
dotnet add package Elsa.Testing.Shared

Installed Testcontainer packages

dotnet add package Testcontainers
dotnet add package Testcontainers.PostgreSql
dotnet add package Testcontainers.RabbitMq

Added in memory Test Base as per docs (does not compile)

From here

None documentation based changes

Try Install/reference missing packages
Reference Elsa.Testing.Shared on InMemoryTestBase

dotnet add Elsa.EntityFrameworkCore (3.5.3)
dotnet add Elsa.EntityFrameworkCore.Common (3.5.3)
dotnet add Microsoft.EntityFrameworkCore.InMemory (10.0.3)

Compile time error

'EFCoreWorkflowRuntimePersistenceFeature' does not contain a definition for 'UseInMemory' and no accessible extension method 'UseInMemory' accepting a first argument of type 'EFCoreWorkflowRuntimePersistenceFeature' could be found (are you missing a using directive or an assembly reference?)

I've attempted to utilise the AI bot on the deepwiki to find answers, it believes that this method simply isn't implemented: "Based on the codebase context, there appears to be no UseInMemory() extension method implemented for Elsa's EF Core persistence features. The documentation you're referencing is likely outdated or incorrect.".

Extra info

Relevant markup of docs in github

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions