Skip to content

Commit c441b73

Browse files
committed
Issue 46: Added 'TestRunner.WorkflowTerminationCodeAsString'.
1 parent 7d99fef commit c441b73

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LogicAppUnit Testing Framework:
66
- Bumped versions of NuGet packages to remove critical vulnerabilities in some of the transitive packages.
77
- 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)]
88
- Updated method `ContentHelper.FormatJson()` to use `JToken.Parse()` instead of `JObject.Parse()`. [[Issue #45](https://github.com/LogicAppUnit/TestingFramework/issues/45)]
9+
- 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)]
910

1011

1112
# 1.10.0 (4th November 2024)

src/LogicAppUnit/ITestRunner.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,17 @@ public interface ITestRunner : IDisposable
7272
bool WorkflowWasTerminated { get; }
7373

7474
/// <summary>
75-
/// Gets the workflow termination code. This only applies when a workflow was terminated with failure.
75+
/// Gets the workflow termination code as an integer value. This only applies when a workflow was terminated with failure.
7676
/// </summary>
7777
/// <returns>The workflow termination code, or <c>null</c> if the workflow was not terminated, or terminated with a status that was not failed.</returns>
7878
int? WorkflowTerminationCode { get; }
7979

80+
/// <summary>
81+
/// Gets the workflow termination code as a string value. This only applies when a workflow was terminated with failure.
82+
/// </summary>
83+
/// <returns>The workflow termination code, or <c>null</c> if the workflow was not terminated, or terminated with a status that was not failed.</returns>
84+
string WorkflowTerminationCodeAsString { get; }
85+
8086
/// <summary>
8187
/// Gets the workflow termination message. This only applies when a workflow was terminated with failure.
8288
/// </summary>

src/LogicAppUnit/TestRunner.cs

+9
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ public int? WorkflowTerminationCode
124124
}
125125
}
126126

127+
/// <inheritdoc cref="ITestRunner.WorkflowTerminationCodeAsString" />
128+
public string WorkflowTerminationCodeAsString
129+
{
130+
get
131+
{
132+
return _apiHelper.WorkflowRunContent()["properties"]["error"]?["code"]?.ToObject<string>();
133+
}
134+
}
135+
127136
/// <inheritdoc cref="ITestRunner.WorkflowTerminationMessage" />
128137
public string WorkflowTerminationMessage
129138
{

0 commit comments

Comments
 (0)