elsa-core/test/unit/Elsa.UnitTests/Services/Models/ActivityExecutionContextTests.cs
Craig Fowler 282c90f80f Further fixup & refactoring of Autofixture attribs
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.
2021-04-02 13:28:27 +01:00

23 lines
1.2 KiB
C#

using Xunit;
using Elsa.Testing.Shared.AutoFixture.Attributes;
using AutoFixture.Xunit2;
using System;
namespace Elsa.Services.Models
{
public class ActivityExecutionContextTests
{
[Theory(DisplayName = "The PurgeVariables method should clear the Variables instance associated with the WorkflowInstance associated with the Workflow Execution Context"), AutoMoqData]
public void PurgeVariables_clears_workflow_execution_context_workflow_instance_variables([WithAutofixtureResolution, Frozen] IServiceProvider serviceProvider,
[OmitOnRecursion,NoAutoProperties] ActivityExecutionContext sut,
string variableName,
object variableValue)
{
sut.WorkflowExecutionContext.WorkflowInstance.Variables.Set(variableName, variableValue);
sut.PurgeVariables();
Assert.Empty(sut.WorkflowExecutionContext.WorkflowInstance.Variables.Data);
}
}
}