Exemplo n.º 1
0
        public void CorectData_ShouldSucceed(string value, int count)
        {
            var result = OrderByParser.TryParse(value, GetAllowedColumns());

            result.IsSuccess.ShouldBeTrue();

            result.Value.OrderBys.Count.ShouldBe(count);
        }
Exemplo n.º 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))));
        }
Exemplo n.º 3
0
        public void IncorectData_ShouldFail()
        {
            var result = OrderByParser.TryParse("abc", GetAllowedColumns());

            result.IsFailure.ShouldBeTrue();
        }