public void HasErrorMessageFalseTest() { // Arrange ResourceGetWithCriteriaResponse target = new ResourceGetWithCriteriaResponse(); // Act string expected = target.ErrorMessage; // Assert Assert.IsNull(expected); Assert.IsFalse(target.HasError); }
public void TotalCountTest() { // Arrange ResourceGetWithCriteriaResponse target = new ResourceGetWithCriteriaResponse(); target.TotalCount = 1; // Act var expected = target.TotalCount; // Assert Assert.IsTrue(expected == 1); }
public void ResultsTest() { // Arrange ResourceGetWithCriteriaResponse target = new ResourceGetWithCriteriaResponse(); target.Results = new List <Resource>(); // Act var expected = target.Results; // Assert Assert.IsNotNull(expected); Assert.IsTrue(expected.Count == 0); }
public IActionResult Search([FromQuery] ResourceSearchCriteria criteria) { if (criteria == null) { return(BadRequest()); } var response = new ResourceGetWithCriteriaResponse(); var results = _service.Search(criteria); if (results != null) { response.Results = results; response.TotalCount = results.TotalCount; } response.ErrorMessage = _service.ErrorMessage; return(Ok(response)); }