Exemple #1
0
        public void ShouldThrowFieldExpressionExceptionWhenParseInvalidPath(string input, int errorIndex)
        {
            Action action = () =>
            {
                FieldPath.ParsePaths(input);
            };

            action.Should().Throw <FieldExpressionException>()
            .WithMessage($"Invalid field path at index: {errorIndex}.");
        }
Exemple #2
0
        public void ShouldSplitWithFunction(string input)
        {
            var fieldPath = FieldPath.ParsePaths(input);
            var expected  = new List <FieldPath>
            {
                new() { FuncName = "abc", SubPaths = new List <FieldPath>() }
            };

            fieldPath.Should().BeEquivalentTo(expected);
        }
Exemple #3
0
        public void ShouldSplitSingleWord(string input)
        {
            var fieldPath = FieldPath.ParsePaths(input);
            var expected  = new FieldPath()
            {
                Field = "abc"
            };

            fieldPath.Should().BeEquivalentTo(expected);
        }
Exemple #4
0
        public void ShouldSplitMultiPaths(string input)
        {
            var fieldPath = FieldPath.ParsePaths(input);
            var expected  = new List <FieldPath>
            {
                new() { Field = "abc" },
                new() { Field = "bcd" },
                new() { Field = "cde" },
                new() { Field = "def" }
            };

            fieldPath.Should().BeEquivalentTo(expected);
        }
Exemple #5
0
        public void ShouldSplitWithFunctionWithMultiSubPaths(string input)
        {
            var fieldPath = FieldPath.ParsePaths(input);
            var expected  = new List <FieldPath>
            {
                new() { FuncName = "abc", SubPaths = new List <FieldPath>()
                        {
                            new() { Field = "bcd" },
                            new() { Field = "cde" },
                            new() { Field = "def" }
                        } },
                new() { Field = "efg" }
            };

            fieldPath.Should().BeEquivalentTo(expected);
        }
Exemple #6
0
        public void ShouldGetOriginPathWhenJoinPathWithNormalizePath(string normalizePath)
        {
            var paths = FieldPath.ParsePaths(normalizePath);

            FieldPath.JoinPaths(paths).Should().Be(normalizePath);
        }