elsa-workflows / elsa-workflows/elsa-gitbook
Testing with In-Memory Databases in main Elsa docs references non-existent UseInMemory() method
- Dominant language
- C#
- Stars
- 9
- Forks
- 30
- Avg merge
- 49m
- Merged PRs (30d)
- 32
Description
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_](https://docs.elsaworkflows.io/guides/testing-debugging#in-memory-db), 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](https://github.com/elsa-workflows/elsa-gitbook/blob/main/guides/testing-debugging.md?plain=1#L776-L830)
### 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](https://deepwiki.com/search/the-main-elsa-docs-contain-a-s_9ae88679-33bc-4db0-acc3-c1cccaf0234e) 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](https://github.com/elsa-workflows/elsa-gitbook/blob/af7a35d392d17d43cf4f8f40f0ea9796f3fe20ed/guides/testing-debugging.md?plain=1#L796-L809)
Contributor guide
Assessment
This issue has not been assessed yet.