Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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
You can’t perform that action at this time.