public SelectEnumerable ( IPath path ) : IEnumerable | ||
path | IPath | |
리턴 | IEnumerable |
string GetSampleData(JToken root, IPath path) { var navigator = new JsonNavigator(root.ToString()); return(string.Join(GlobalConstants.AnythingToXmlPathSeperator, navigator.SelectEnumerable(path) .Select( o => o.ToString() .Replace(GlobalConstants.AnythingToXmlPathSeperator, GlobalConstants.AnytingToXmlCommaToken)) .Take(10))); }
public void SelectEnumerableValuesUsingEnumerablePathFromJson_WherePathMapsThroughNestedEnumerables_Expected_EnumerableValue() { string testData = Given(); IPath path = new JsonPath("Departments().Employees().Name", "Departments.Employees.Name"); JsonNavigator JsonNavigator = new JsonNavigator(testData); string actual = string.Join("|", JsonNavigator.SelectEnumerable(path).Select(o => o.ToString().Trim())); const string expected = "Brendon|Jayd|Bob|Joe"; Assert.AreEqual(expected, actual); }
public void SelectEnumerableValuesUsingScalarPathFromJson_Expected_EnumerableValue() { string testData = Given(); IPath path = new JsonPath("Motto", "Motto"); JsonNavigator JsonNavigator = new JsonNavigator(testData); string actual = string.Join("|", JsonNavigator.SelectEnumerable(path).Select(o => o.ToString().Trim())); const string expected = "Eat lots of cake"; Assert.AreEqual(expected, actual); }
public void SelectEnumerableValuesUsingEnumerablePathFromJson_Expected_EnumerableValue() { string testData = Given(); IPath path = new JsonPath("Departments().Name", "Departments.Name"); JsonNavigator JsonNavigator = new JsonNavigator(testData); string actual = string.Join("|", JsonNavigator.SelectEnumerable(path).Select(o => o.ToString().Trim())); const string expected = "Dev|Accounts"; Assert.AreEqual(expected, actual); }
public void SelectEnumerableValuesUsingEnumerablePathFromJson_WherePathMapsToPrimitiveEnumerable_Expected_EnumerableValue() { string testData = Given(); IPath path = new JsonPath("PrimitiveRecordset()", "PrimitiveRecordset"); JsonNavigator JsonNavigator = new JsonNavigator(testData); string actual = string.Join("|", JsonNavigator.SelectEnumerable(path).Select(o => o.ToString().Trim())); const string expected = "RandomData|RandomData1"; Assert.AreEqual(expected, actual); }
private string GetSampleData(JToken root, IPath path) { var navigator = new JsonNavigator(root.ToString()); return string.Join(GlobalConstants.AnythingToXmlPathSeperator, navigator.SelectEnumerable(path) .Select( o => o.ToString() .Replace(GlobalConstants.AnythingToXmlPathSeperator, GlobalConstants.AnytingToXmlCommaToken)) .Take(10)); }