Skip to content

Changes for 1.11.0. #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions .azure-devops/pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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)'
Expand All @@ -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
Expand All @@ -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

Expand Down
15 changes: 13 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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}]
Expand Down Expand Up @@ -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
68 changes: 33 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand All @@ -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
11 changes: 11 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
20 changes: 20 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>

<PropertyGroup>

<!-- Enable code analysis -->
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-recommended</AnalysisLevel>

<!-- Enable NuGet package auditing -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>

<!-- Warnings and Errors -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>

</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void BuiltInConnectorWorkflowTest_When_Invalid_Language_Code()
}
}

private static HttpContent GetServiceBusMessageForTriggerNoLanguageCode()
private static StringContent GetServiceBusMessageForTriggerNoLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
Expand Down Expand Up @@ -228,7 +228,7 @@ private static HttpContent GetServiceBusMessageForTriggerNoLanguageCode()
});
}

private static HttpContent GetServiceBusMessageForTriggerWithValidLanguageCode()
private static StringContent GetServiceBusMessageForTriggerWithValidLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
Expand Down Expand Up @@ -268,7 +268,7 @@ private static HttpContent GetServiceBusMessageForTriggerWithValidLanguageCode()
});
}

private static HttpContent GetServiceBusMessageForTriggerWithInvalidLanguageCode()
private static StringContent GetServiceBusMessageForTriggerWithInvalidLanguageCode()
{
return ContentHelper.CreateJsonStringContent(new
{
Expand Down Expand Up @@ -308,7 +308,7 @@ private static HttpContent GetServiceBusMessageForTriggerWithInvalidLanguageCode
});
}

private static object GetSQLExecuteResponse()
private static object[] GetSQLExecuteResponse()
{
return new object[]
{
Expand All @@ -323,11 +323,9 @@ private static object GetSQLExecuteResponse()
};
}

private static object GetSQLExecuteResponseNoRecords()
private static object[] GetSQLExecuteResponseNoRecords()
{
return new object[]
{
};
return System.Array.Empty<object>();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>LogicAppUnit.Samples.LogicApps.Tests</RootNamespace>
<IsPackable>false</IsPackable>
<!-- Code analysis -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down Expand Up @@ -68,7 +63,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void ManagedApiConnectorWorkflowTest_When_Send_Email_Fails()
}
}

private static HttpContent GetRequest()
private static StringContent GetRequest()
{
return ContentHelper.CreateJsonStringContent(new
{
Expand Down
10 changes: 3 additions & 7 deletions src/LogicAppUnit.Samples.LogicApps/connections.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"connection": {
"id": "/subscriptions/@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}/resourceGroups/@{appsetting('WORKFLOWS_RESOURCE_GROUP_NAME')}/providers/Microsoft.Web/connections/salesforce01"
},
"connectionRuntimeUrl": "https://7606763fdc09952f.10.common.logic-uksouth.azure-apihub.net/apim/salesforce/fba515601ef14f9193eee596a9dcfd1c/",
"connectionRuntimeUrl": "@parameters('salesforce-ConnectionRuntimeUrl')",
"authentication": {
"type": "Raw",
"scheme": "Key",
Expand All @@ -59,12 +59,8 @@
"connection": {
"id": "/subscriptions/@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}/resourceGroups/@{appsetting('WORKFLOWS_RESOURCE_GROUP_NAME')}/providers/Microsoft.Web/connections/outlook01"
},
"connectionRuntimeUrl": "@appsetting('Outlook-ManagedConnectionRuntimeUrl')",
"authentication": {
"type": "Raw",
"scheme": "Key",
"parameter": "@appsetting('Outlook-ConnectionKey')"
}
"connectionRuntimeUrl": "@parameters('outlook-ConnectionRuntimeUrl')",
"authentication": "@parameters('outlook-Authentication')"
}
}
}
3 changes: 2 additions & 1 deletion src/LogicAppUnit.Samples.LogicApps/local.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"AzureQueue-ConnectionString": "any-queue-connection-string",
"Outlook-ConnectionKey": "any-outlook-connection-key",
"Outlook-SubjectPrefix": "INFORMATION",
"Outlook-ManagedConnectionRuntimeUrl": "https://7606763fdc09952f.10.common.logic-uksouth.azure-apihub.net/apim/outlook/79a0bc680716416e90e17323b581695d/",
"Outlook-ConnectionRuntimeUrl": "https://7606763fdc09952f.10.common.logic-uksouth.azure-apihub.net/apim/outlook/79a0bc680716416e90e17323b581695d/",
"Salesforce-ConnectionKey": "any-salesforce-connection-key",
"Salesforce-ConnectionRuntimeUrl": "https://7606763fdc09952f.10.common.logic-uksouth.azure-apihub.net/apim/salesforce/fba515601ef14f9193eee596a9dcfd1c/",
"ServiceOne-Url": "https://external-service-one.testing.net/api/v1",
"ServiceOne-Authentication-APIKey": "serviceone-auth-apikey",
"ServiceOne-Authentication-WebHook-APIKey": "serviceone-auth-webhook-apikey",
Expand Down
Loading