public void Null2() { var item = new Item(); var rp = new ReflectionPath("SubItem.X"); Assert.That(rp.GetValue(item), Is.Null); }
public void Null2() { var item = new Item(); var rp = new ReflectionPath("SubItem.X"); object result; Assert.IsTrue(rp.TryGetValue(item, out result)); Assert.That(rp.GetValue(item), Is.Null); }
public void InvalidPath() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.Z"); object result; Assert.IsFalse(rp.TryGetValue(item, out result)); Assert.Throws<InvalidOperationException>(() => rp.GetValue(item)); }
public void Null2() { var item = new Item(); var rp = new ReflectionPath("SubItem.X"); object result; Assert.IsTrue(rp.TryGetValue(item, out result)); Assert.That(rp.GetValue(item), Is.Null); }
public void PointInStructure() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.X"); Assert.That(rp.GetValue(item), Is.EqualTo(1)); }
public void SimpleProperty() { var item = new Item { Number = 41 }; var rp = new ReflectionPath("Number"); Assert.That(rp.GetValue(item), Is.EqualTo(41)); }
public void InvalidPath() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.Z"); Assert.Throws <InvalidOperationException>(() => rp.GetValue(item)); }
public void InvalidPath() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.Z"); object result; Assert.IsFalse(rp.TryGetValue(item, out result)); Assert.Throws <InvalidOperationException>(() => rp.GetValue(item)); }
public void SimpleProperty() { var item = new Item { Number = 41 }; var rp = new ReflectionPath("Number"); object result; Assert.IsTrue(rp.TryGetValue(item, out result)); Assert.That(rp.GetValue(item), Is.EqualTo(41)); }
public void Performance() { var item = new Item { SubItem = new Item { Point = new DataPoint(1, 2) } }; var rp = new ReflectionPath("SubItem.Point.X"); var w = Stopwatch.StartNew(); for (int i = 0; i < 1000000; i++) { rp.GetValue(item); } Console.WriteLine(w.ElapsedMilliseconds); }
public void Performance() { var item = new Item { SubItem = new Item { Point = new DataPoint(1, 2) } }; var rp = new ReflectionPath("SubItem.Point.X"); var w = Stopwatch.StartNew(); for (int i = 0; i < 1000000; i++) { rp.GetValue(item); } Console.WriteLine(w.ElapsedMilliseconds); }
public void InvalidPath() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.Z"); Assert.Throws<InvalidOperationException>(() => rp.GetValue(item)); }
public void PointInSubStructure() { var item = new Item { SubItem = new Item { Point = new DataPoint(1, 2) } }; var rp = new ReflectionPath("SubItem.Point.X"); Assert.That(rp.GetValue(item), Is.EqualTo(1)); }
public void SimpleProperty() { var item = new Item { Number = 41 }; var rp = new ReflectionPath("Number"); Assert.That(rp.GetValue(item), Is.EqualTo(41)); }
public void Null2() { var item = new Item(); var rp = new ReflectionPath("SubItem.X"); Assert.That(rp.GetValue(item), Is.Null); }
public void SimpleProperty() { var item = new Item { Number = 41 }; var rp = new ReflectionPath("Number"); object result; Assert.IsTrue(rp.TryGetValue(item, out result)); Assert.That(rp.GetValue(item), Is.EqualTo(41)); }
public void PointInStructure() { var item = new Item { Point = new DataPoint(1, 2) }; var rp = new ReflectionPath("Point.X"); object result; Assert.IsTrue(rp.TryGetValue(item, out result)); Assert.That(rp.GetValue(item), Is.EqualTo(1)); }