예제 #1
0
        public void SafeNullable_ValueProperty_NotNullInstace_FunctionExecuted()
        {
            var notNull = new SafeSubject {
                ValueProperty = 3
            };

            Assert.That(notNull.SafeValue(o => o.ValueProperty), Is.EqualTo(3));
        }
예제 #2
0
        public void SafeValue_NullableProperty_NotNullInstace_FunctionExecuted()
        {
            var notNull = new SafeSubject {
                NullableProperty = 3
            };

            Assert.That(notNull.SafeValue(o => o.NullableProperty), Is.EqualTo(3));

            // null is a valid proprety value
            notNull = new SafeSubject {
                NullableProperty = null
            };
            Assert.That(notNull.SafeValue(o => o.NullableProperty), Is.Null);
        }
예제 #3
0
        public void SafeValue_NullableProperty_NullInstace_Null()
        {
            SafeSubject @null = null;

            Assert.That(@null.SafeValue(o => o.NullableProperty), Is.Null);
        }