Skip to content

Commit cb8451b

Browse files
committed
samples, readme
1 parent 8a22a15 commit cb8451b

File tree

14 files changed

+312
-4
lines changed

14 files changed

+312
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ There are several persistence providers available as separate Nuget packages.
114114

115115
* [Human(User) Workflow](src/samples/WorkflowCore.Sample08)
116116

117+
* [Testing](src/samples/WorkflowCore.TestSample01)
118+
117119

118120
## Authors
119121

File renamed without changes.

WorkflowCore.sln

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ EndProject
9191
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReleaseNotes", "ReleaseNotes", "{38ECB00C-3F3B-4442-8408-ACE3B37FFAA8}"
9292
ProjectSection(SolutionItems) = preProject
9393
ReleaseNotes\1.2.8.md = ReleaseNotes\1.2.8.md
94-
1.2.9.md = 1.2.9.md
94+
ReleaseNotes\1.2.9.md = ReleaseNotes\1.2.9.md
9595
EndProjectSection
9696
EndProject
9797
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkflowCore.Sample14", "src\samples\WorkflowCore.Sample14\WorkflowCore.Sample14.csproj", "{6BC66637-B42A-4334-ADFB-DBEC9F29D293}"
9898
EndProject
9999
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowCore.Testing", "test\WorkflowCore.Testing\WorkflowCore.Testing.csproj", "{62A9709E-27DA-42EE-B94F-5AF431D86354}"
100100
EndProject
101+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowCore.TestSample01", "src\samples\WorkflowCore.TestSample01\WorkflowCore.TestSample01.csproj", "{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E}"
102+
EndProject
101103
Global
102104
GlobalSection(SolutionConfigurationPlatforms) = preSolution
103105
Debug|Any CPU = Debug|Any CPU
@@ -252,6 +254,10 @@ Global
252254
{62A9709E-27DA-42EE-B94F-5AF431D86354}.Debug|Any CPU.Build.0 = Debug|Any CPU
253255
{62A9709E-27DA-42EE-B94F-5AF431D86354}.Release|Any CPU.ActiveCfg = Release|Any CPU
254256
{62A9709E-27DA-42EE-B94F-5AF431D86354}.Release|Any CPU.Build.0 = Release|Any CPU
257+
{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
258+
{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
259+
{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
260+
{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E}.Release|Any CPU.Build.0 = Release|Any CPU
255261
EndGlobalSection
256262
GlobalSection(SolutionProperties) = preSolution
257263
HideSolutionNode = FALSE
@@ -297,5 +303,6 @@ Global
297303
{A2374B7C-4198-40B3-B8FE-FAC3DB3F2539} = {2EEE6ABD-EE9B-473F-AF2D-6DABB85D7BA2}
298304
{6BC66637-B42A-4334-ADFB-DBEC9F29D293} = {5080DB09-CBE8-4C45-9957-C3BB7651755E}
299305
{62A9709E-27DA-42EE-B94F-5AF431D86354} = {E6CEAD8D-F565-471E-A0DC-676F54EAEDEB}
306+
{0E3C1496-8E7C-411A-A536-C7C9CE4EED4E} = {5080DB09-CBE8-4C45-9957-C3BB7651755E}
300307
EndGlobalSection
301308
EndGlobal

src/providers/WorkflowCore.Persistence.MongoDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Provides support to persist workflows running on [Workflow Core](../../README.md
77
Install the NuGet package "WorkflowCore.Persistence.MongoDB"
88

99
```
10-
PM> Install-Package WorkflowCore.Persistence.MongoDB -Pre
10+
PM> Install-Package WorkflowCore.Persistence.MongoDB
1111
```
1212

1313
## Usage

src/providers/WorkflowCore.Persistence.SqlServer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Provides support to persist workflows running on [Workflow Core](../../README.md
77
Install the NuGet package "WorkflowCore.Persistence.SqlServer"
88

99
```
10-
PM> Install-Package WorkflowCore.Persistence.SqlServer -Pre
10+
PM> Install-Package WorkflowCore.Persistence.SqlServer
1111
```
1212

1313
## Usage
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using FluentAssertions;
2+
using NUnit.Framework;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
using WorkflowCore.Models;
7+
using WorkflowCore.Testing;
8+
using WorkflowCore.TestSample01.Workflow;
9+
10+
namespace WorkflowCore.TestSample01
11+
{
12+
[TestFixture]
13+
public class NUnitTest : WorkflowTest<MyWorkflow, MyDataClass>
14+
{
15+
[SetUp]
16+
protected override void Setup()
17+
{
18+
base.Setup();
19+
}
20+
21+
[Test]
22+
public void NUnit_workflow_test_sample()
23+
{
24+
var workflowId = StartWorkflow(new MyDataClass() { Value1 = 2, Value2 = 3 });
25+
WaitForWorkflowToComplete(workflowId, TimeSpan.FromSeconds(30));
26+
27+
GetStatus(workflowId).Should().Be(WorkflowStatus.Complete);
28+
UnhandledStepErrors.Count.Should().Be(0);
29+
GetData(workflowId).Value3.Should().Be(5);
30+
}
31+
32+
}
33+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using WorkflowCore.Interface;
5+
using WorkflowCore.Models;
6+
7+
namespace WorkflowCore.TestSample01.Workflow
8+
{
9+
public class AddNumbers : StepBody
10+
{
11+
public int Input1 { get; set; }
12+
public int Input2 { get; set; }
13+
public int Output { get; set; }
14+
15+
public override ExecutionResult Run(IStepExecutionContext context)
16+
{
17+
Output = (Input1 + Input2);
18+
return ExecutionResult.Next();
19+
}
20+
}
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace WorkflowCore.TestSample01.Workflow
6+
{
7+
public class MyDataClass
8+
{
9+
public int Value1 { get; set; }
10+
public int Value2 { get; set; }
11+
public int Value3 { get; set; }
12+
}
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using WorkflowCore.Interface;
5+
6+
namespace WorkflowCore.TestSample01.Workflow
7+
{
8+
public class MyWorkflow : IWorkflow<MyDataClass>
9+
{
10+
public string Id => "MyWorkflow";
11+
public int Version => 1;
12+
public void Build(IWorkflowBuilder<MyDataClass> builder)
13+
{
14+
builder
15+
.StartWith<AddNumbers>()
16+
.Input(step => step.Input1, data => data.Value1)
17+
.Input(step => step.Input2, data => data.Value2)
18+
.Output(data => data.Value3, step => step.Output);
19+
}
20+
}
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp1.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="FluentAssertions" Version="4.19.2" />
9+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
10+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="1.1.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
12+
<PackageReference Include="NUnit" Version="3.7.1" />
13+
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
14+
<PackageReference Include="xunit" Version="2.2.0" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\..\..\test\WorkflowCore.Testing\WorkflowCore.Testing.csproj" />
20+
<ProjectReference Include="..\..\WorkflowCore\WorkflowCore.csproj" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
25+
</ItemGroup>
26+
27+
</Project>

0 commit comments

Comments
 (0)