Esempio n. 1
0
        public void IsValidShouldBeTrueWhenNoErrorIsProvidedWithController()
        {
            // arrange
            ODataException error      = null;
            var            controller = new Mock <ApiController>().Object;
            var            result     = new ODataQueryValidationResult(error, controller);
            var            expected   = true;

            // act
            var actual = result.IsValid;

            // assert
            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void IsValidShouldBeFalseWhenErrorIsProvidedWithController()
        {
            // arrange
            var error      = new ODataException("Failed validation.");
            var controller = new Mock <ApiController>().Object;
            var result     = new ODataQueryValidationResult(error, controller);
            var expected   = false;

            // act
            var actual = result.IsValid;

            // assert
            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void IsValidShouldBeTrueWhenNoErrorIsProvidedWithoutController()
        {
            // arrange
            ODataException error             = null;
            var            contentNegotiator = new Mock <IContentNegotiator>().Object;
            var            request           = new HttpRequestMessage();
            var            formatters        = Enumerable.Empty <MediaTypeFormatter>();
            var            result            = new ODataQueryValidationResult(error, contentNegotiator, request, formatters);
            var            expected          = true;

            // act
            var actual = result.IsValid;

            // assert
            Assert.Equal(expected, actual);
        }