Skip to content

Commit 37401a7

Browse files
committed
adding more tests
Signed-off-by: Neil South <[email protected]>
1 parent 69e94bb commit 37401a7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/UnitTests/Common.Tests/Services/WorkflowServiceTests.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ public async Task WorkflowService_NoExistingWorkflow_ReturnsNull()
5353
Assert.Null(result);
5454
}
5555

56+
[Fact]
57+
public async Task WorkflowService_GetAsync_With_Empty()
58+
{
59+
await Assert.ThrowsAsync<ArgumentException>(() => WorkflowService.GetAsync(string.Empty));
60+
}
61+
62+
[Fact]
63+
public async Task WorkflowService_GetByNameAsync_With_Empty()
64+
{
65+
await Assert.ThrowsAsync<ArgumentException>(() => WorkflowService.GetByNameAsync(string.Empty));
66+
}
67+
68+
[Fact]
69+
public async Task WorkflowService_CreateAsync_With_Empty()
70+
{
71+
await Assert.ThrowsAsync<ArgumentNullException>(() => WorkflowService.CreateAsync(null));
72+
}
73+
5674
[Fact]
5775
public async Task WorkflowService_WorkflowExists_ReturnsWorkflowId()
5876
{
@@ -88,5 +106,39 @@ public async Task WorkflowService_WorkflowExists_ReturnsWorkflowId()
88106

89107
Assert.Equal(workflowRevision.WorkflowId, result);
90108
}
109+
110+
[Fact]
111+
public async Task WorkflowService_DeleteWorkflow_With_Empty()
112+
{
113+
await Assert.ThrowsAsync<ArgumentNullException>(() => WorkflowService.DeleteWorkflowAsync(null));
114+
}
115+
116+
[Fact]
117+
public async Task WorkflowService_DeleteWorkflow_Calls_SoftDelete()
118+
{
119+
var result = await WorkflowService.DeleteWorkflowAsync(new WorkflowRevision());
120+
_workflowRepository.Verify(r => r.SoftDeleteWorkflow(It.IsAny<WorkflowRevision>()), Times.Once());
121+
}
122+
123+
[Fact]
124+
public async Task WorkflowService_Count_Calls_Count()
125+
{
126+
var result = await WorkflowService.CountAsync();
127+
_workflowRepository.Verify(r => r.CountAsync(), Times.Once());
128+
}
129+
130+
[Fact]
131+
public async Task WorkflowService_GetCountByAeTitleAsync_Calls_Count()
132+
{
133+
var result = await WorkflowService.GetCountByAeTitleAsync("string");
134+
_workflowRepository.Verify(r => r.GetCountByAeTitleAsync(It.IsAny<string>()), Times.Once());
135+
}
136+
137+
[Fact]
138+
public async Task WorkflowService_GetAllAsync_Calls_GetAllAsync()
139+
{
140+
var result = await WorkflowService.GetAllAsync(1, 2);
141+
_workflowRepository.Verify(r => r.GetAllAsync(It.IsAny<int>(), It.IsAny<int>()), Times.Once());
142+
}
91143
}
92144
}

0 commit comments

Comments
 (0)