The test coverage here actually proves that for Liquid expressions,
the issue has already been fixed as part of other work. Specifically
it was fixed in 2a22a328c4 in the
class StringExtensions.cs
This change means that a service provider may use both the Frozen
specimen builder and also the 'with autofixture resolution' behaviour.
That means that some unwanted extra logic in the test may now be
removed, with the test objects also coming from Autofixture.
This now also includes reworking the attribute which activates
Autofixture-style resolution upon an IServiceProvider.
This has now been renamed to WithAutofixtureResolutionAttribute.
The new/reworked attribute is composable with other Autofixture
attributes.
This removes all of the (now actually non-trivial) conversion logic from
the class which is actually responsible for executing the Jint engine.
This moves it all to a new service which uses chain of responsibility to
convert the result, using one of a few different mechanisms.
Of note is the handling of ExpandoObject when no specific type
information has been provided, and also the handling of enumerables,
with the exception of strings.
Unfortunately Jint still chokes in this case if the expando contains
further nested expandos. It turns out that I need to do this
recursively for it to always work.
We also have trouble with IEnumerable types. They also can't be
round-tripped from/to JSON when they aren't deserialized as a very
specific type.
It appears that this can be fixed by intercepting occasions
when Jint returns an ExpandoObject but the desired return type
is simply object. In this scenario we must return
a Dictionary<string,object> instead of a simple object, or else
Jint freaks out should we try to stringify it later.
I also added a second test to prove that making this change hasn't
broken the way we expect Jint to work for us.
This means that the model:
* Implements IConvertible so that Jint may implicitly convert
it to other types as if it were just a string.
* The Values & Values properties are perhaps a little less confusing
now, and present a more consistent set of state, regardless of
the inner model.
* There's a minor simplification to ToString, since String.Join already
did what we wanted for one or many values.
Notable though is - because this class implements IConvertible,
it is no longer CLS compliant. We do not currently mark this assembly
as CLS complient so as things stand that's OK. I do not know if there
are any plans/expectations for CLS compliance in Elsa.
If we do plan to mark the assemblies as compliant then we must mark this
class [CLSCompliant(false)].
This extension method is quite complex and is frustrating
when a unit test passes-through it. That's because extension
methods can't be mocked in tests.
The triggers-for-activity-blueprint functionality
is quite complex just on its own, so I have moved this to
a new service.
Once again the integration test which is left behind proves
that it still does the same job.
It actually turns out that no change is required to the SignalReceived
activity in order to achieve this. As these unit tests prove & document,
that is already the current behaviour.
Adds an XUnit test logger to each test csproj
file (will be used by test script).
Also add a skeleton SonarCloud analysis config file with a couple
of settings for starters: Don't analyse exception classes or samples
for coverage.
This reverts commit 3dc1b79b3b, reversing
changes made to 1dbafd8ba2.
The previous merge of work on #665 broke the build so this commit
reverts it back out.
Adds an XUnit test logger to each test csproj
file (will be used by test script).
Also add a skeleton SonarCloud analysis config file with a couple
of settings for starters: Don't analyse exception classes or samples
for coverage.
* WIP #653 - Delete two tests
These two couldn't easily be fixed, in both cases they were
integration tests which involved passing through many classes.
It wasn't immediately clear what needed to be done to fix them.
As noted in the issue description, removing them was an
acceptable fix.
* WIP #653 - Fix a failing test
I split this test into two. Per the discussion at:
https://github.com/xunit/xunit/issues/350
XUnit seems quite opinonated about not having assertion messages.
Thus, without changing assertion library (which deserves discussion
before I just do it), the logical next best thing is to split into two
single-assert tests, so it's clear which assertion failed on a test
failure.
Also, I moved the AutoMoqData attribute to the shared test lib, so
that it can be used anywhere. That allowed me to eliminate the
constructor for this test class, except for initialising the base class.
* Provisionally resolve#653 - reinstate tests in CI
This should complete the issue although we need to see a
passing CI build with this code change before we can say
it's done.
* Provisionally resolves#653 - Add test script
* 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