diff --git a/.azure-devops/pipelines/build.yml b/.azure-devops/pipelines/build.yml
index 48d32a3..337a651 100644
--- a/.azure-devops/pipelines/build.yml
+++ b/.azure-devops/pipelines/build.yml
@@ -24,9 +24,9 @@ jobs:
Windows:
imageName: 'windows-latest'
matrixName: Windows
- #Mac:
- # imageName: 'macOS-latest'
- # matrixName: Mac
+ Mac:
+ imageName: 'macOS-latest'
+ matrixName: Mac
pool:
vmImage: $(imageName)
@@ -35,13 +35,6 @@ jobs:
# Build .NET solution
- - task: UseDotNet@2
- displayName: 'Setup .NET'
- inputs:
- packageType: sdk
- version: '6.x'
- installationPath: $(Agent.ToolsDirectory)/dotnet
-
- task: DotNetCoreCLI@2
displayName: 'Restore dependencies'
inputs:
@@ -58,26 +51,16 @@ jobs:
# Install and configure Logic Apps runtime environment
- - task: NodeTool@0
- displayName: 'Setup node'
- inputs:
- versionSpec: '18.x'
-
- task: FuncToolsInstaller@0
displayName: 'Install Functions core tools'
inputs:
version: 'latest'
- - task: CmdLine@2
- displayName: 'Check Functions Core tools installation'
- inputs:
- script: func
-
- task: Npm@1
displayName: 'Install Azurite'
inputs:
command: 'custom'
- customCommand: 'install -g azurite@3.33.0'
+ customCommand: 'install -g azurite@3.34.0'
- task: CmdLine@2
displayName: 'Start Azurite services (not Windows)'
@@ -91,6 +74,23 @@ jobs:
inputs:
script: 'start /b azurite'
+ # Check software versions
+
+ - task: CmdLine@2
+ displayName: 'Check dotnet SDK installation'
+ inputs:
+ script: dotnet --info
+
+ - task: CmdLine@2
+ displayName: 'Check node installation'
+ inputs:
+ script: node --version
+
+ - task: CmdLine@2
+ displayName: 'Check Functions Core tools installation'
+ inputs:
+ script: func --version
+
# Run tests and publish test results to Azure DevOps
- task: DotNetCoreCLI@2
@@ -104,16 +104,16 @@ jobs:
publishTestResults: true
testRunTitle: 'Tests ($(matrixName))'
- - task: DotNetCoreCLI@2
- displayName: 'Run tests (Windows)'
- condition: and(succeeded(), eq(variables.matrixName, 'Windows'))
- continueOnError: true
- inputs:
- command: test
- arguments: '--no-restore --verbosity normal --configuration ${{ parameters.buildConfiguration }}'
- projects: '$(System.DefaultWorkingDirectory)/src/LogicAppUnit.sln'
- publishTestResults: true
- testRunTitle: 'Tests ($(matrixName))'
+ # - task: DotNetCoreCLI@2 # there is an issue with Azurite ports being blocked when running tests on Windows build servers
+ # displayName: 'Run tests (Windows)'
+ # condition: and(succeeded(), eq(variables.matrixName, 'Windows'))
+ # continueOnError: true
+ # inputs:
+ # command: test
+ # arguments: '--no-restore --verbosity normal --configuration ${{ parameters.buildConfiguration }}'
+ # projects: '$(System.DefaultWorkingDirectory)/src/LogicAppUnit.sln'
+ # publishTestResults: true
+ # testRunTitle: 'Tests ($(matrixName))'
# Publish NuGet package
diff --git a/.editorconfig b/.editorconfig
index 0d652c5..bff08ce 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,12 +1,13 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://EditorConfig.org
-# top-most EditorConfig file
root = true
-# Don't use tabs for indentation
+# All files
[*]
indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
# Code files
[*.{cs,csx}]
@@ -38,3 +39,13 @@ dotnet_diagnostic.CA1310.severity = none
# Underscores are acceptable for unit test names.
[*.cs]
dotnet_diagnostic.CA1707.severity = none
+
+# CA1852: Seal internal types
+# Sealing classes provides minimal performance improvements and is not a concern.
+[*.cs]
+dotnet_diagnostic.CA1852.severity = none
+
+# CA1866: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char
+# Implementing this causes the unit tests to break on macOS and Linux platforms!
+[*.cs]
+dotnet_diagnostic.CA1866.severity = none
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b25ce27..748b8c4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -25,11 +25,6 @@ jobs:
uses: actions/checkout@v3
# Build .NET solution
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore ${{ github.workspace }}/src/LogicAppUnit.sln
@@ -39,11 +34,6 @@ jobs:
# Install and configure Logic Apps runtime environment
- - name: Setup node
- uses: actions/setup-node@v3
- with:
- node-version: 18
-
- name: Install Functions Core tools
run: 'npm install -g azure-functions-core-tools@4 --unsafe-perm true'
@@ -52,40 +42,48 @@ jobs:
run: 'setx /m Path "C:\npm\prefix\node_modules\azure-functions-core-tools\bin;%Path%"'
shell: cmd
- - name: Check Functions Core tools installation
- run: 'func'
-
- name: Install Azurite
- run: 'npm install -g azurite@3.33.0'
+ run: 'npm install -g azurite@3.34.0'
- name: Start Azurite services
run: 'azurite &'
shell: bash
+ # Check software versions
+
+ - name: Check dotnet SDK installation
+ run: 'dotnet --info'
+
+ - name: Check node installation
+ run: 'node --version'
+
+ - name: Check Functions Core tools installation
+ run: 'func --version'
+
# Run tests
- # - name: Run tests
- # if: success() && matrix.os != 'windows-latest'
- # run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx" --filter TestCategory!="WindowsOnly"
+ - name: Run tests
+ if: success() && matrix.os != 'windows-latest'
+ run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx" --filter TestCategory!="WindowsOnly"
- # - name: Run tests
- # if: success() && matrix.os == 'windows-latest'
- # run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx"
+ - name: Run tests
+ if: success() && matrix.os == 'windows-latest'
+ run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx"
# Publish artefacts and test results
- # - name: Publish test log
- # uses: actions/upload-artifact@v3
- # if: success() || failure()
- # with:
- # name: test-results.${{ matrix.os }}
- # path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
-
- # - name: Publish test results
- # if: (success() || failure()) && github.event_name != 'pull_request'
- # uses: dorny/test-reporter@v1
- # with:
- # name: Test Results (${{ matrix.os }})
- # path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
- # path-replace-backslashes: true
- # reporter: dotnet-trx
+ - name: Publish test log
+ uses: actions/upload-artifact@v4
+ if: success() || failure()
+ with:
+ name: test-results.${{ matrix.os }}
+ path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
+
+ - name: Publish test results
+ if: (success() || failure()) && github.event_name != 'pull_request'
+ uses: dorny/test-reporter@v2
+ with:
+ name: Test Results (${{ matrix.os }})
+ path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
+ path-replace-backslashes: true
+ reporter: dotnet-trx
diff --git a/ChangeLog.md b/ChangeLog.md
index f218c85..e661288 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,14 @@
+# 1.11.0 (11th April 2025)
+
+LogicAppUnit Testing Framework:
+
+- The framework now supports parameterised connections that are created by the Standard Logic App extension. [[Issue #42](https://github.com/LogicAppUnit/TestingFramework/issues/42)]
+- Bumped versions of NuGet packages to remove critical vulnerabilities in some of the transitive packages.
+- Added configuration for NuGet Audit so that any future vulnerabilities are logged as build warnings and do not break the LogicAppUnit build. [[Issue #40](https://github.com/LogicAppUnit/TestingFramework/issues/40)]
+- Updated method `ContentHelper.FormatJson()` to use `JToken.Parse()` instead of `JObject.Parse()`. [[Issue #45](https://github.com/LogicAppUnit/TestingFramework/issues/45)]
+- Added new property `TestRunner.WorkflowTerminationCodeAsString` that returns the workflow termination code as a string value. The existing property `TestRunner.WorkflowTerminationCode` returns the code as an integer value, but the code is defined as a string data type in the workflow schema reference documentation. [[Issue #46](https://github.com/LogicAppUnit/TestingFramework/issues/46)]
+
+
# 1.10.0 (4th November 2024)
LogicAppUnit Testing Framework:
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..8aec736
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,20 @@
+
+
+
+
+
+ false
+ True
+ latest-recommended
+
+
+ true
+ all
+ low
+
+
+ true
+ NU1901;NU1902;NU1903;NU1904
+
+
+
diff --git a/src/LogicAppUnit.Samples.LogicApps.Tests/BuiltInConnectorWorkflow/BuiltInConnectorWorkflowTest.cs b/src/LogicAppUnit.Samples.LogicApps.Tests/BuiltInConnectorWorkflow/BuiltInConnectorWorkflowTest.cs
index 7f1afaf..fa5f8df 100644
--- a/src/LogicAppUnit.Samples.LogicApps.Tests/BuiltInConnectorWorkflow/BuiltInConnectorWorkflowTest.cs
+++ b/src/LogicAppUnit.Samples.LogicApps.Tests/BuiltInConnectorWorkflow/BuiltInConnectorWorkflowTest.cs
@@ -189,7 +189,7 @@ public void BuiltInConnectorWorkflowTest_When_Invalid_Language_Code()
}
}
- private static HttpContent GetServiceBusMessageForTriggerNoLanguageCode()
+ private static StringContent GetServiceBusMessageForTriggerNoLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
@@ -228,7 +228,7 @@ private static HttpContent GetServiceBusMessageForTriggerNoLanguageCode()
});
}
- private static HttpContent GetServiceBusMessageForTriggerWithValidLanguageCode()
+ private static StringContent GetServiceBusMessageForTriggerWithValidLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
@@ -268,7 +268,7 @@ private static HttpContent GetServiceBusMessageForTriggerWithValidLanguageCode()
});
}
- private static HttpContent GetServiceBusMessageForTriggerWithInvalidLanguageCode()
+ private static StringContent GetServiceBusMessageForTriggerWithInvalidLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
@@ -308,7 +308,7 @@ private static HttpContent GetServiceBusMessageForTriggerWithInvalidLanguageCode
});
}
- private static object GetSQLExecuteResponse()
+ private static object[] GetSQLExecuteResponse()
{
return new object[]
{
@@ -323,11 +323,9 @@ private static object GetSQLExecuteResponse()
};
}
- private static object GetSQLExecuteResponseNoRecords()
+ private static object[] GetSQLExecuteResponseNoRecords()
{
- return new object[]
- {
- };
+ return System.Array.Empty