Skip to content

Commit 8877c5f

Browse files
add tests
Signed-off-by: Jack Schofield <[email protected]>
1 parent f4b1c53 commit 8877c5f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/UnitTests/WorkflowManager.Tests/Controllers/WorkflowsControllerTests.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,5 +663,43 @@ public void ValidateWorkflow_ValidatesAWorkflow_ReturnsTrueAndHasCorrectValidati
663663
WorkflowValidator.Reset();
664664
}
665665
}
666+
667+
[Fact]
668+
public void ValidateWorkflow_ValidatesEmptyWorkflow_ReturnsTrueAndHasCorrectValidationResultsAsync()
669+
{
670+
for (var i = 0; i < 15; i++)
671+
{
672+
var workflow = new Workflow();
673+
674+
var workflowHasErrors = WorkflowValidator.ValidateWorkflow(workflow, out var results);
675+
676+
Assert.True(workflowHasErrors);
677+
678+
Assert.Equal(7, results.Errors.Count);
679+
680+
var error1 = "'' is not a valid Workflow Description (source: Unnamed workflow).";
681+
Assert.Contains(error1, results.Errors);
682+
683+
var error2 = "'informaticsGateway' cannot be null (source: Unnamed workflow).";
684+
Assert.Contains(error2, results.Errors);
685+
686+
var error3 = "'' is not a valid AE Title (source: informaticsGateway).";
687+
Assert.Contains(error3, results.Errors);
688+
689+
var error4 = "'' is not a valid Informatics Gateway - exportDestinations (source: informaticsGateway).";
690+
Assert.Contains(error4, results.Errors);
691+
692+
var error5 = "Missing Workflow Name.";
693+
Assert.Contains(error5, results.Errors);
694+
695+
var error6 = "Missing Workflow Version.";
696+
Assert.Contains(error6, results.Errors);
697+
698+
var error7 = "Missing Workflow Tasks.";
699+
Assert.Contains(error7, results.Errors);
700+
701+
WorkflowValidator.Reset();
702+
}
703+
}
666704
}
667705
}

0 commit comments

Comments
 (0)