-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: added unit test for abstract base classes implementing IAsyncZe…
…ebeWorker
- Loading branch information
1 parent
4a06db6
commit c3065b6
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/Zeebe.Client.Accelerator.Unit.Tests/Stubs/JobHandlerI.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Zeebe.Client.Accelerator.Unit.Tests.Stubs | ||
{ | ||
public class JobHandlerI : TypedInputHandlerBase<ExtendedJobHState> | ||
{ | ||
public static IList<Guid> guids = new List<Guid>(); | ||
|
||
protected override Task HandleJob(ExtendedJobHState variables, CancellationToken cancellationToken) | ||
{ | ||
guids.Add(variables.Guid); | ||
return Task.CompletedTask; | ||
} | ||
} | ||
|
||
public class ExtendedJobHState : JobHState | ||
{ | ||
public string ExtraAttr { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
test/Zeebe.Client.Accelerator.Unit.Tests/Stubs/TypedInputHandlerBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Zeebe.Client.Accelerator.Abstractions; | ||
using Zeebe.Client.Accelerator.Attributes; | ||
|
||
namespace Zeebe.Client.Accelerator.Unit.Tests.Stubs | ||
{ | ||
public abstract class TypedInputHandlerBase<TInput> : IAsyncZeebeWorker<TInput> where TInput : JobHState, new () | ||
{ | ||
protected abstract Task HandleJob(TInput variables, CancellationToken cancellationToken); | ||
|
||
public async Task HandleJob(ZeebeJob<TInput> job, CancellationToken cancellationToken) | ||
{ | ||
await HandleJob(job.getVariables(), cancellationToken); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters