public void ValuePathWhenNullInPath() { Fake = new Fake(); var path = Get.ValuePath <ValuePathTests, string>(x => x.Fake.Next.Name); var value = path.GetValue(this); Assert.IsFalse(value.HasValue); // ReSharper disable once UnusedVariable Assert.Throws <InvalidOperationException>(() => { var temp = value.Value; }); }
public void ValuePathWhenHasNullValue() { Fake = new Fake { Next = new Level { Name = null } }; var path = Get.ValuePath <ValuePathTests, string>(x => x.Fake.Next.Name); var value = path.GetValue(this); Assert.IsTrue(value.HasValue); Assert.AreEqual(null, value.Value); }