コード例 #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);
        }