Esempio n. 1
0
        public void MaybeDeep_nullFirstStep_returnsNull()
        {
            var instance = new MaybeTestHelper() {NestedInstance = null};
            var actual = instance.MaybeDeep(x => x.NestedInstance.DeepProperty);

            Assert.IsNull( actual);
        }
Esempio n. 2
0
        public void MaybeDeep_NestedValue_returnsValue()
        {
            var expected = "expected";
            var instance = new MaybeTestHelper()
                               {NestedInstance = new MaybeTestHelper() {DeepProperty =expected }};
            var actual = instance.MaybeDeep(x => x.NestedInstance.DeepProperty);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void MaybeShallowNullable_value_returnsValue()
        {
            //arrange
            var instance = new MaybeTestHelper();
            var expected = MaybeTestHelper.HasValueConstant;

            var actual = instance.MaybeShallowNullable(x => x.InstanceNullableIntFieldWithValue);

            Assert.AreEqual(expected, actual.Value);
        }
Esempio n. 4
0
 public void MaybeDeep_PrimitiveValue_ThrowsArgumentException()
 {
     var instance = new MaybeTestHelper();
     try
     {
         var action = instance.MaybeDeep(x => x.InstanceIntField);
         Assert.Fail("Did not throw exception");
     }
     catch (Exception ex)
     {
         Assert.IsInstanceOfType(ex, typeof(ArgumentException));
     }
 }
Esempio n. 5
0
 public void Maybe_NullableValueWithNull_ReturnsNull()
 {
     var instance = new MaybeTestHelper();
     var actual = instance.MaybeDeep(x => x.InstanceNullableIntField);
     Assert.IsNull(actual);
 }
Esempio n. 6
0
 public void MaybeDeep_nullSecondStep_returnsNull()
 {
     var instance = new MaybeTestHelper()
                        {NestedInstance = new MaybeTestHelper() {NestedInstance = null}};
     var actual = instance.MaybeDeep(i => i.NestedInstance.NestedInstance.DeepProperty);
 }
Esempio n. 7
0
 public void Maybe_NullableValueWithValue_ReturnsValue()
 {
     var instance = new MaybeTestHelper();
     int? expected = MaybeTestHelper.HasValueConstant;
     var actual = instance.MaybeDeep(x => x.InstanceNullableIntFieldWithValue);
     Assert.AreEqual(expected, actual);
 }