Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created November 6, 2019 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/552f5c6f539fcdd1273348aa0c7da64b to your computer and use it in GitHub Desktop.
Save IntegerMan/552f5c6f539fcdd1273348aa0c7da64b to your computer and use it in GitHub Desktop.
[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