@@ -48,7 +48,7 @@ public class WorkflowsControllerTests
4848
4949 public WorkflowsControllerTests ( )
5050 {
51- _options = Options . Create ( new WorkflowManagerOptions ( ) ) ;
51+ _options = Options . Create ( new WorkflowManagerOptions { EndpointSettings = new EndpointSettings { MaxPageSize = 99 } } ) ;
5252 _workflowService = new Mock < IWorkflowService > ( ) ;
5353
5454 _logger = new Mock < ILogger < WorkflowsController > > ( ) ;
@@ -883,5 +883,68 @@ public async Task DeleteAsync_WorkflowsGivenInvalidId_ShouldBadRequest()
883883 const string expectedInstance = "/workflows" ;
884884 Assert . StartsWith ( expectedInstance , ( ( ProblemDetails ) objectResult . Value ) . Instance ) ;
885885 }
886+
887+ [ Fact ]
888+ public async Task GetByAeTitle_WorkflowsGivenEmptyTitle_ShouldBadRequest ( )
889+ {
890+
891+ var result = await WorkflowsController . GetByAeTitle ( string . Empty , null ) ;
892+
893+ var objectResult = Assert . IsType < ObjectResult > ( result ) ;
894+ Assert . Equal ( "Failed to validate title, not a valid AE title" , result . As < ObjectResult > ( ) . Value . As < ProblemDetails > ( ) . Detail ) ;
895+
896+ Assert . Equal ( 400 , objectResult . StatusCode ) ;
897+
898+ const string expectedInstance = "/workflows" ;
899+ Assert . StartsWith ( expectedInstance , ( ( ProblemDetails ) objectResult . Value ) . Instance ) ;
900+ }
901+
902+ [ Fact ]
903+ public async Task GetByAeTitle_ShouldCall_GetByAeTitleAsync ( )
904+ {
905+
906+ var result = await WorkflowsController . GetByAeTitle ( "test" , new PaginationFilter ( ) ) ;
907+ var objectResult = Assert . IsType < OkObjectResult > ( result ) ;
908+
909+ _workflowService . Verify ( x => x . GetByAeTitleAsync ( "test" , It . IsAny < int > ( ) , It . IsAny < int > ( ) ) , Times . Once ) ;
910+
911+ Assert . Equal ( 200 , objectResult . StatusCode ) ;
912+ }
913+
914+ [ Fact ]
915+ public async Task GetByAeTitle_ShouldCall_GetByAeTitleAsync_With_Skip ( )
916+ {
917+
918+ var result = await WorkflowsController . GetByAeTitle ( "test" , new PaginationFilter { PageSize = 2 , PageNumber = 2 } ) ;
919+ var objectResult = Assert . IsType < OkObjectResult > ( result ) ;
920+
921+ _workflowService . Verify ( x => x . GetByAeTitleAsync ( "test" , 2 , It . IsAny < int > ( ) ) , Times . Once ) ;
922+
923+ Assert . Equal ( 200 , objectResult . StatusCode ) ;
924+ }
925+
926+ [ Fact ]
927+ public async Task GetByAeTitle_ShouldCall_GetByAeTitleAsync_With_Limit ( )
928+ {
929+
930+ var result = await WorkflowsController . GetByAeTitle ( "test" , new PaginationFilter { PageNumber = 2 , PageSize = 45 } ) ;
931+ var objectResult = Assert . IsType < OkObjectResult > ( result ) ;
932+
933+ _workflowService . Verify ( x => x . GetByAeTitleAsync ( "test" , It . IsAny < int > ( ) , 45 ) , Times . Once ) ;
934+
935+ Assert . Equal ( 200 , objectResult . StatusCode ) ;
936+ }
937+
938+ [ Fact ]
939+ public async Task GetByAeTitle_ShouldCall_GetCountByAeTitleAsync ( )
940+ {
941+
942+ var result = await WorkflowsController . GetByAeTitle ( "test" , new PaginationFilter ( ) ) ;
943+ var objectResult = Assert . IsType < OkObjectResult > ( result ) ;
944+
945+ _workflowService . Verify ( x => x . GetCountByAeTitleAsync ( "test" ) , Times . Once ) ;
946+
947+ Assert . Equal ( 200 , objectResult . StatusCode ) ;
948+ }
886949 }
887950}
0 commit comments