Created
November 6, 2019 02:39
-
-
Save IntegerMan/552f5c6f539fcdd1273348aa0c7da64b to your computer and use it in GitHub Desktop.
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
[HttpGet] | |
public async Task<ActionResult<IEnumerable<TestCase>>> GetTestCase() | |
{ | |
return await _context.TestCase.ToListAsync(); | |
} | |
[HttpGet("passing")] | |
public async Task<ActionResult<IEnumerable<TestCase>>> GetPassingTestCases() | |
{ | |
return await GetTestCasesByStatusAsync(TestStatus.Passing); | |
} | |
[HttpGet("failed")] | |
public async Task<ActionResult<IEnumerable<TestCase>>> GetFailedTestCases() | |
{ | |
return await GetTestCasesByStatusAsync(TestStatus.Failed); | |
} | |
[HttpGet("pending")] | |
public async Task<ActionResult<IEnumerable<TestCase>>> GetPendingTestCases() | |
{ | |
return await GetTestCasesByStatusAsync(TestStatus.NotRun); | |
} | |
private async Task<List<TestCase>> GetTestCasesByStatusAsync(TestStatus status) | |
{ | |
return await _context.TestCase.Where(t => t.Status == status).ToListAsync(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment