public void Execute_FromElement_ValueCorrect() { var from = "//PurchaseOrder/Items/Item/ProductName"; var selects = new List <ElementSelect>() { new ElementSelect(".") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That((result.ElementAt(0) as IEnumerable <object>).ElementAt(0), Is.EqualTo("Lawnmower")); } }
public void Execute_ChildElement_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List <ElementSelect>() { new ElementSelect("//PurchaseOrder/Items/Item/ProductName") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.EqualTo("Lawnmower")); } }
public void Execute_MissingAttribute_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List <ElementSelect>() { new AttributeSelect("//PurchaseOrder", "Missing") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That((result.ElementAt(0) as IEnumerable <object>).ElementAt(0), Is.EqualTo("(null)")); } }
public void Execute_MissingAttribute_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List <ElementSelect>() { new AttributeSelect("//PurchaseOrder", "Missing") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.EqualTo(DBNull.Value)); } }
public void Execute_ChildElement_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List<ElementSelect>() { new ElementSelect("//PurchaseOrder/Items/Item/ProductName") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.EqualTo("Lawnmower")); } }
public void Execute_ChildAttribute_ValueCorrect() { var from = "//PurchaseOrder/Items"; var selects = new List<ElementSelect>() { new AttributeSelect("//PurchaseOrder/Items/Item","PartNumber") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.EqualTo("872-AA")); } }
public void Execute_Example_RowCount(string from, int rowCount) { var selects = new List <ElementSelect>() { new ElementSelect("//PurchaseOrder/PurchaseOrderNumber") , new AttributeSelect(".", "PartNumber") , new ElementSelect("//PurchaseOrder/Address[@Type=\"Shiping\"]/City") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Count, Is.EqualTo(rowCount)); } }
public void Execute_ParentElement_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List <ElementSelect>() { new ElementSelect("//PurchaseOrder") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That((result.ElementAt(0) as IEnumerable <object>).ElementAt(0), Is.StringStarting("Ellen Adams")); Assert.That((result.ElementAt(0) as IEnumerable <object>).ElementAt(0), Is.StringContaining("Maple Street")); } }
public void Execute_Example_ColumnCount() { var from = "//PurchaseOrder/Items/Item"; var selects = new List <ElementSelect>() { new ElementSelect("//PurchaseOrder/PurchaseOrderNumber") , new AttributeSelect(".", "PartNumber") , new ElementSelect("//PurchaseOrder/Address[@Type=\"Shiping\"]/City") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That((result.ElementAt(0) as IEnumerable <object>).Count, Is.EqualTo(3)); } }
public void Execute_Example_ColumnCount() { var from = "//PurchaseOrder/Items/Item"; var selects = new List<ElementSelect>() { new ElementSelect("//PurchaseOrder/PurchaseOrderNumber") , new AttributeSelect(".", "PartNumber") , new ElementSelect("//PurchaseOrder/Address[@Type=\"Shiping\"]/City") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Columns.Count, Is.EqualTo(3)); } }
public void Execute_ParentElement_ValueCorrect() { var from = "//PurchaseOrder/Items/Item"; var selects = new List<ElementSelect>() { new ElementSelect("//PurchaseOrder") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.StringStarting("Ellen Adams")); Assert.That(result.Rows[0].ItemArray[0], Is.StringContaining("Maple Street")); } }
public void Execute_MissingElement_Null() { var from = "//PurchaseOrder/Items/Item"; var selects = new List<ElementSelect>() { new ElementSelect("//PurchaseOrder/Missing") }; using (var reader = GetResourceReader()) { var engine = new XPathStreamEngine(reader, from, selects); var result = engine.Execute(); Assert.That(result.Rows[0].ItemArray[0], Is.EqualTo(DBNull.Value)); } }