public void ShouldThrowFieldExpressionExceptionWhenParseInvalidPath(string input, int errorIndex) { Action action = () => { FieldPath.ParsePaths(input); }; action.Should().Throw <FieldExpressionException>() .WithMessage($"Invalid field path at index: {errorIndex}."); }
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); }
public void ShouldSplitSingleWord(string input) { var fieldPath = FieldPath.ParsePaths(input); var expected = new FieldPath() { Field = "abc" }; fieldPath.Should().BeEquivalentTo(expected); }
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); }
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); }
public void ShouldGetOriginPathWhenJoinPathWithNormalizePath(string normalizePath) { var paths = FieldPath.ParsePaths(normalizePath); FieldPath.JoinPaths(paths).Should().Be(normalizePath); }