Skip to content

Commit 7966a75

Browse files
Changes for 1.10.0. (#39)
Co-authored-by: MarkAbrams <[email protected]> Co-authored-by: Mark Abrams <[email protected]>
1 parent 5131ac0 commit 7966a75

File tree

26 files changed

+434
-60
lines changed

26 files changed

+434
-60
lines changed

.azure-devops/pipelines/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
displayName: 'Install Azurite'
7878
inputs:
7979
command: 'custom'
80-
customCommand: 'install -g azurite@3.24.0'
80+
customCommand: 'install -g azurite@3.33.0'
8181

8282
- task: CmdLine@2
8383
displayName: 'Start Azurite services (not Windows)'

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@ indent_size = 2
2828
# Clarity of intent is not required, this is non-localizable code.
2929
[*.cs]
3030
dotnet_diagnostic.CA1307.severity = none
31+
32+
# CA1310: Specify StringComparison for correctness
33+
# User locales are not a concern.
34+
[*.cs]
35+
dotnet_diagnostic.CA1310.severity = none
36+
37+
# CA1707: Identifiers should not contain underscores
38+
# Underscores are acceptable for unit test names.
39+
[*.cs]
40+
dotnet_diagnostic.CA1707.severity = none

.github/workflows/build.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [ubuntu-latest, windows-latest, macos-latest]
19+
os: [ubuntu-latest, windows-latest] # macos-latest
2020

2121
runs-on: ${{ matrix.os }}
2222

@@ -56,36 +56,36 @@ jobs:
5656
run: 'func'
5757

5858
- name: Install Azurite
59-
run: 'npm install -g azurite@3.24.0'
59+
run: 'npm install -g azurite@3.33.0'
6060

6161
- name: Start Azurite services
6262
run: 'azurite &'
6363
shell: bash
6464

6565
# Run tests
6666

67-
- name: Run tests
68-
if: success() && matrix.os != 'windows-latest'
69-
run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx" --filter TestCategory!="WindowsOnly"
67+
# - name: Run tests
68+
# if: success() && matrix.os != 'windows-latest'
69+
# run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx" --filter TestCategory!="WindowsOnly"
7070

71-
- name: Run tests
72-
if: success() && matrix.os == 'windows-latest'
73-
run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx"
71+
# - name: Run tests
72+
# if: success() && matrix.os == 'windows-latest'
73+
# run: dotnet test ${{ github.workspace }}/src/LogicAppUnit.sln --no-restore --verbosity normal --logger "trx"
7474

7575
# Publish artefacts and test results
7676

77-
- name: Publish test log
78-
uses: actions/upload-artifact@v3
79-
if: success() || failure()
80-
with:
81-
name: test-results.${{ matrix.os }}
82-
path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
83-
84-
- name: Publish test results
85-
if: (success() || failure()) && github.event_name != 'pull_request'
86-
uses: dorny/test-reporter@v1
87-
with:
88-
name: Test Results (${{ matrix.os }})
89-
path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
90-
path-replace-backslashes: true
91-
reporter: dotnet-trx
77+
# - name: Publish test log
78+
# uses: actions/upload-artifact@v3
79+
# if: success() || failure()
80+
# with:
81+
# name: test-results.${{ matrix.os }}
82+
# path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
83+
84+
# - name: Publish test results
85+
# if: (success() || failure()) && github.event_name != 'pull_request'
86+
# uses: dorny/test-reporter@v1
87+
# with:
88+
# name: Test Results (${{ matrix.os }})
89+
# path: ${{ github.workspace }}/src/LogicAppUnit.Samples.LogicApps.Tests/TestResults/*.trx
90+
# path-replace-backslashes: true
91+
# reporter: dotnet-trx

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BenchmarkDotNet.Artifacts/
6060
# .NET Core
6161
project.lock.json
6262
project.fragment.lock.json
63-
artifacts/
63+
#artifacts/
6464

6565
# ASP.NET Scaffolding
6666
ScaffoldingReadMe.txt

ChangeLog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 1.10.0 (4th November 2024)
2+
3+
LogicAppUnit Testing Framework:
4+
5+
- The testing of workflows that call in-line C# is now supported. The .csx script files are copied to the test working directory and are not mocked. [[PR #35](https://github.com/LogicAppUnit/TestingFramework/pull/35), [@sschutten](https://github.com/sschutten)]
6+
- Added a new configuration option `workflow.managedApisToMock` in the `testConfiguration.json` file to control which Managed API connectors are mocked. If this configuration is not set, all Managed API connectors are mocked - this ensures backwards compatabiity with previous versions. [[PR #38](https://github.com/LogicAppUnit/TestingFramework/pull/38), [@zzznz27](https://github.com/zzznz27)]
7+
8+
LogicAppUnit.Samples.LogicApps.Tests:
9+
10+
- Added a `call-data-mapper-workflow` workflow and unit tests to test workflows that call the data mapper.
11+
- Added a `inline-script-workflow` workflow and unit tests to test workflows that call in-line C# script (.csx) files.
12+
13+
114
# 1.9.0 (23rd January 2024)
215

316
LogicAppUnit Testing Framework:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This code repository includes four projects:
4141

4242
Download the *LogicAppUnit* testing framework package from nuget: https://www.nuget.org/packages/LogicAppUnit/
4343

44-
[![NuGet Badge](https://buildstats.info/nuget/LogicAppUnit)](https://www.nuget.org/packages/LogicAppUnit)
44+
[![NuGet Version Badge](https://img.shields.io/nuget/v/LogicAppUnit)](https://www.nuget.org/packages/LogicAppUnit) [![NuGet Download Badge](https://img.shields.io/nuget/dt/LogicAppUnit)](https://www.nuget.org/packages/LogicAppUnit)
4545

4646

4747
## Compatibility
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using LogicAppUnit.Helper;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using System.Net;
4+
using System.Net.Http;
5+
6+
namespace LogicAppUnit.Samples.LogicApps.Tests.CallDataMapperWorkflow
7+
{
8+
/// <summary>
9+
/// Test cases for the <i>call-data-mapper-workflow</i> workflow which calls a XSLT map that exists in the same Logic App.
10+
/// </summary>
11+
[TestClass]
12+
public class CallDataMapperWorkflowTest : WorkflowTestBase
13+
{
14+
private const string XmlContentType = "application/xml";
15+
16+
[TestInitialize]
17+
public void TestInitialize()
18+
{
19+
Initialize(Constants.LOGIC_APP_TEST_EXAMPLE_BASE_PATH, Constants.CALL_DATA_MAPPER_WORKFLOW);
20+
}
21+
22+
[ClassCleanup]
23+
public static void CleanResources()
24+
{
25+
Close();
26+
}
27+
28+
/// <summary>
29+
/// Tests the workflow when the calling of the map is successful.
30+
/// This test can only be run on Windows:
31+
/// https://learn.microsoft.com/en-us/azure/logic-apps/create-maps-data-transformation-visual-studio-code#limitations-and-known-issues
32+
/// </summary>
33+
[TestMethod]
34+
[TestCategory("WindowsOnly")]
35+
public void CallDataMapperWorkflowTest_When_Successful()
36+
{
37+
using (ITestRunner testRunner = CreateTestRunner())
38+
{
39+
// Run the workflow
40+
var workflowResponse = testRunner.TriggerWorkflow(
41+
ContentHelper.CreateStreamContent(ResourceHelper.GetAssemblyResourceAsStream($"{GetType().Namespace}.MockData.WorkflowRequest.xml"), XmlContentType),
42+
HttpMethod.Post);
43+
44+
// Check workflow run status
45+
Assert.AreEqual(WorkflowRunStatus.Succeeded, testRunner.WorkflowRunStatus);
46+
47+
// Check workflow response
48+
Assert.AreEqual(HttpStatusCode.OK, workflowResponse.StatusCode);
49+
Assert.AreEqual(XmlContentType, workflowResponse.Content.Headers.ContentType.MediaType);
50+
Assert.AreEqual(
51+
ContentHelper.FormatXml(ResourceHelper.GetAssemblyResourceAsStream($"{GetType().Namespace}.MockData.WorkflowResponse.xml")),
52+
ContentHelper.FormatXml(workflowResponse.Content.ReadAsStreamAsync().Result));
53+
54+
// Check action result
55+
Assert.AreEqual(ActionStatus.Succeeded, testRunner.GetWorkflowActionStatus("Transform_using_Data_Mapper"));
56+
Assert.AreEqual(ActionStatus.Succeeded, testRunner.GetWorkflowActionStatus("Response_Success"));
57+
Assert.AreEqual(ActionStatus.Skipped, testRunner.GetWorkflowActionStatus("Response_Failure"));
58+
}
59+
}
60+
}
61+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<CustomerCampaigns xmlns="http://schemas.logicappunit.net/CustomerCampaign/v1">
2+
<Campaign>
3+
<CampaignId>7612</CampaignId>
4+
<CampaignName>This is a really long campaign name that will be shortened</CampaignName>
5+
<CustomerId>100567</CustomerId>
6+
<FirstName>Peter</FirstName>
7+
<LastName>Smith</LastName>
8+
<Email>[email protected]</Email>
9+
<Age>45</Age>
10+
<SiteCode>982</SiteCode>
11+
</Campaign>
12+
<Campaign>
13+
<CampaignId>7613</CampaignId>
14+
<CampaignName>Another campaign</CampaignName>
15+
<CustomerId>100845</CustomerId>
16+
<FirstName>John</FirstName>
17+
<LastName>Jackson</LastName>
18+
<Email>[email protected]</Email>
19+
<Age>29</Age>
20+
<SiteCode>1908</SiteCode>
21+
</Campaign>
22+
<Campaign>
23+
<CampaignId>7614</CampaignId>
24+
<CampaignName>Another campaign</CampaignName>
25+
<CustomerId>104009</CustomerId>
26+
<FirstName>Simon</FirstName>
27+
<LastName>Atkins</LastName>
28+
<Email>[email protected]</Email>
29+
<Age>50</Age>
30+
<SiteCode>1908</SiteCode>
31+
</Campaign>
32+
</CustomerCampaigns>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tns:campaignRequest xmlns:tns="http://schemas.logicappunit.net/CampaignRequest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
numberOfCampaigns="3">
4+
<tns:campaign>
5+
<tns:campaignDetails>
6+
<tns:id>7612</tns:id>
7+
<tns:name>This is a really lo</tns:name>
8+
</tns:campaignDetails>
9+
<tns:customer>
10+
<tns:id>100567</tns:id>
11+
<tns:forename>Peter</tns:forename>
12+
<tns:surname>Smith</tns:surname>
13+
<tns:email>[email protected]</tns:email>
14+
<tns:age>45</tns:age>
15+
</tns:customer>
16+
<tns:premisesid>982</tns:premisesid>
17+
</tns:campaign>
18+
<tns:campaign>
19+
<tns:campaignDetails>
20+
<tns:id>7613</tns:id>
21+
<tns:name>Another campaign</tns:name>
22+
</tns:campaignDetails>
23+
<tns:customer>
24+
<tns:id>100845</tns:id>
25+
<tns:forename>John</tns:forename>
26+
<tns:surname>Jackson</tns:surname>
27+
<tns:email>[email protected]</tns:email>
28+
<tns:age>29</tns:age>
29+
</tns:customer>
30+
<tns:premisesid>1908</tns:premisesid>
31+
</tns:campaign>
32+
<tns:campaign>
33+
<tns:campaignDetails>
34+
<tns:id>7614</tns:id>
35+
<tns:name>Another campaign</tns:name>
36+
</tns:campaignDetails>
37+
<tns:customer>
38+
<tns:id>104009</tns:id>
39+
<tns:forename>Simon</tns:forename>
40+
<tns:surname>Atkins</tns:surname>
41+
<tns:email>[email protected]</tns:email>
42+
<tns:age>50</tns:age>
43+
</tns:customer>
44+
<tns:premisesid>1908</tns:premisesid>
45+
</tns:campaign>
46+
</tns:campaignRequest>

src/LogicAppUnit.Samples.LogicApps.Tests/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static class Constants
1010

1111
// Workflows
1212
public static readonly string BUILT_IN_CONNECTOR_WORKFLOW = "built-in-connector-workflow";
13+
public static readonly string CALL_DATA_MAPPER_WORKFLOW = "call-data-mapper-workflow";
1314
public static readonly string CALL_LOCAL_FUNCTION_WORKFLOW = "call-local-function-workflow";
1415
public static readonly string FLUENT_REQUEST_MATCHING_WORKFLOW = "fluent-workflow";
1516
public static readonly string HTTP_WORKFLOW = "http-workflow";

0 commit comments

Comments
 (0)