As well as providing a unit test which matches other persistence
provider tests (round-tripping a workflow instance), two other tests
are included here:
* When using the default DI registration extension method, this sets
up pooling of DB contexts and so a resolved context will come from
the pool.
* When using the non-pooled DI registration extension method, this
sets up EF without pooling, which is more useful in a multi-tenanted
environment.
There are also some other changes in this commit corresponding to
improving the tests. Mainly de-duplicating logic & improving names.
This refactor of integration test logic is to boost its
reusability. Moving some functionality to attributes &
customization classes means I can reuse elsewhere without
duplication.
* Trivial - Add VS Code workspace
* Trivial - Add VSCode build task & extra ignore
On GNU/Linux, auto-generated .directory
files should be ignored.
* WIP #485 - Boilerplate for unit test project
* WIP #485 - Add test coverage (Remove/RemoveAll)
* WIP #485 - Implement RemoveAll
* Remove redundant logic, covered by IDictionary
Per the following, the contract for a generic IDictionary,
the Remove method already deals with non-existent keys.
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.idictionary-2.remove?view=net-5.0#System_Collections_Generic_IDictionary_2_Remove__0_
* Resolve#485 - Add PurgeVariables methods
These are convenience methods upon ActivityExecutionContext
and WorkflowExecutionContext, consistent with their current APIs.
Also in this commit are tests for those simple methods.
There's a bit of test-scaffold as well included, such as:
* Autofixture Xunit2 integration
* New project for unit tests
* Customize attribute for avoiding crashes on Autofixture recursion
* Reusable specimen builder for creating IServiceProvider which
resolves services from Autofixture
* Custonize attribute for a parameter to use that ^^ specimen builder
* Seperate YesSql and added InMemory, MongoDb
* Error fixed, if DatabaseInitializer is run through several times
* icon.png was not packed
* Added AddWorkflowProvider to AddElsaPersistenceMongoDb
* Wrong primary keys were used for MongoDb
* Refactorig MongoDb
* Register IMongoCollection<WorkflowDefinition> and IMongoCollection<WorkflowInstance> with DI
* Wrong Parameter Type in Constructor (MongoDbWorkflowInstanceRepository)
* Add workflowDefinition.WorkflowDefinitionId = _idGenerator.Generate(); to Initialize
* Removed duplicated code
* Correct wrong Commit
Co-authored-by: Rafael Carnucci <rafael.carnucci@icn.de>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>