Example #1
0
 public void SinglePropertyAndIndexer()
 {
   JPath path = new JPath("Blah[0]");
   Assert.AreEqual(2, path.Parts.Count);
   Assert.AreEqual("Blah", path.Parts[0]);
   Assert.AreEqual(0, path.Parts[1]);
 }
Example #2
0
 public void TwoProperties()
 {
   JPath path = new JPath("Blah.Two");
   Assert.AreEqual(2, path.Parts.Count);
   Assert.AreEqual("Blah", path.Parts[0]);
   Assert.AreEqual("Two", path.Parts[1]);
 }
Example #3
0
 public void AdditionalDots()
 {
   JPath path = new JPath(".Blah..[0]..Two.Three....[1].Four.");
   Assert.AreEqual(6, path.Parts.Count);
   Assert.AreEqual("Blah", path.Parts[0]);
   Assert.AreEqual(0, path.Parts[1]);
   Assert.AreEqual("Two", path.Parts[2]);
   Assert.AreEqual("Three", path.Parts[3]);
   Assert.AreEqual(1, path.Parts[4]);
   Assert.AreEqual("Four", path.Parts[5]);
 }
Example #4
0
 public void MultiplePropertiesAndIndexers()
 {
   JPath path = new JPath("Blah[0].Two.Three[1].Four");
   Assert.AreEqual(6, path.Parts.Count);
   Assert.AreEqual("Blah", path.Parts[0]);
   Assert.AreEqual(0, path.Parts[1]);
   Assert.AreEqual("Two", path.Parts[2]);
   Assert.AreEqual("Three", path.Parts[3]);
   Assert.AreEqual(1, path.Parts[4]);
   Assert.AreEqual("Four", path.Parts[5]);
 }
Example #5
0
 public void IndexerOnly()
 {
   JPath path = new JPath("[111119990]");
   Assert.AreEqual(1, path.Parts.Count);
   Assert.AreEqual(111119990, path.Parts[0]);
 }
Example #6
0
 public void SingleProperty()
 {
   JPath path = new JPath("Blah");
   Assert.AreEqual(1, path.Parts.Count);
   Assert.AreEqual("Blah", path.Parts[0]);
 }
Example #7
0
 public void AdjacentIndexers()
 {
   JPath path = new JPath("[1][0][0][" + int.MaxValue + "]");
   Assert.AreEqual(4, path.Parts.Count);
   Assert.AreEqual(1, path.Parts[0]);
   Assert.AreEqual(0, path.Parts[1]);
   Assert.AreEqual(0, path.Parts[2]);
   Assert.AreEqual(int.MaxValue, path.Parts[3]);
 }