Пример #1
0
        public void HasErrorMessageFalseTest()
        {
            // Arrange
            ChildResourceGetWithCriteriaResponse target = new ChildResourceGetWithCriteriaResponse();

            // Act
            string expected = target.ErrorMessage;

            // Assert
            Assert.IsNull(expected);
            Assert.IsFalse(target.HasError);
        }
Пример #2
0
        public void TotalCountTest()
        {
            // Arrange
            ChildResourceGetWithCriteriaResponse target = new ChildResourceGetWithCriteriaResponse();

            target.TotalCount = 1;

            // Act
            var expected = target.TotalCount;

            // Assert
            Assert.IsTrue(expected == 1);
        }
Пример #3
0
        public void ResultsTest()
        {
            // Arrange
            ChildResourceGetWithCriteriaResponse target = new ChildResourceGetWithCriteriaResponse();

            target.Results = new List <ChildResource>();

            // Act
            var expected = target.Results;

            // Assert
            Assert.IsNotNull(expected);
            Assert.IsTrue(expected.Count == 0);
        }
Пример #4
0
        public IActionResult Search([FromQuery] ChildResourceSearchCriteria criteria)
        {
            if (criteria == null)
            {
                return(BadRequest());
            }
            var response = new ChildResourceGetWithCriteriaResponse();
            var results  = _service.Search(criteria);

            if (results != null)
            {
                response.Results    = results;
                response.TotalCount = results.TotalCount;
            }
            response.ErrorMessage = _service.ErrorMessage;
            return(Ok(response));
        }