Esempio n. 1
0
        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; });
        }
Esempio n. 2
0
        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);
        }