public void CorectData_ShouldSucceed(string value, int count)
        {
            var result = OrderByParser.TryParse(value, GetAllowedColumns());

            result.IsSuccess.ShouldBeTrue();

            result.Value.OrderBys.Count.ShouldBe(count);
        }
Example #2
0
        public static IResult <Query, NonEmptyString> TryCreate(string orderBy, int skip, int top, Guid id)
        {
            var orderByParseResult = OrderByParser.TryParse(orderBy, Columns.GetAllowedColumns());

            return(orderByParseResult.
                   OnSuccess(orderBys => OrderByTopSkip.TryCreate(orderBys, skip, top, (NonEmptyString)nameof(TopSkip.Top), (NonEmptyString)nameof(TopSkip.Skip))).
                   OnSuccess(orderByTopSkip => GetOkResult(new Query(orderByTopSkip, id))));
        }
        public void IncorectData_ShouldFail()
        {
            var result = OrderByParser.TryParse("abc", GetAllowedColumns());

            result.IsFailure.ShouldBeTrue();
        }