Example #1
0
        public void Validate_NumericButNotWithinRange_ShouldBeRemoved_EdgeCase()
        {
            // arrange
            string queryStringDummy = "?sort=10&anything=else";
            string expectedResult   = "anything=else";

            // act
            SortKeyQueryStringValidator sortValidator = new SortKeyQueryStringValidator();
            string result = sortValidator.Validate(queryStringDummy);

            // assert
            Assert.Equal(expectedResult, result);
        }
Example #2
0
        public void Validate_ValidValue_ShouldBeKept_EdgeCase()
        {
            // arrange
            string queryStringDummy = "?sort=9&anything=else";
            string expectedResult   = queryStringDummy;

            // act
            SortKeyQueryStringValidator sortValidator = new SortKeyQueryStringValidator();
            string result = sortValidator.Validate(queryStringDummy);

            // assert
            Assert.Equal(expectedResult, result);
        }
Example #3
0
        public void Validate_UnspecifiedKey_ShouldBeIgnored()
        {
            // arrange
            string queryStringDummy = "?notSort=hey";
            string expectedResult   = queryStringDummy;

            // act
            SortKeyQueryStringValidator sortValidator = new SortKeyQueryStringValidator();
            string result = sortValidator.Validate(queryStringDummy);

            // assert
            Assert.Equal(expectedResult, result);
        }