public void RequiresNotNullForNestedGenericNotNullRefArgument() { var sample = new ClassWithGenericNestedClass.NestedUnconstrained <string>(); var exception = Assert.Throws <InvalidOperationException>(() => { var value = ""; sample.DisallowedNullAndNotNullRefValue(ref value); }); }
public void PropertyGetterThrowsOnNullReturnForNestedGenericWithNotNull() { var sample = new ClassWithGenericNestedClass.NestedUnconstrained <string>(); Assert.Throws <InvalidOperationException>(() => { var dummy = sample.PossiblyNullPropertyWithNotNull; }); }
public void RequiresNotNullForNestedGenericDisallowNullRefArgument() { var sample = new ClassWithGenericNestedClass.NestedUnconstrained <string>(); var exception = Assert.Throws <ArgumentNullException>(() => { string value = null; sample.DisallowedNullAndNotNullRefValue(ref value); }); Assert.Equal("nonNullArg", exception.ParamName); }
public void PropertySetterThrowForNestedGenericWithDisallowNull() { var sample = new ClassWithGenericNestedClass.NestedUnconstrained <string>(); Assert.Throws <ArgumentNullException>(() => sample.PossiblyNullPropertyWithDisallowNull = null); }