public void RequiresNotNullForNestedGenericNotNullRefArgument()
 {
     var sample    = new ClassWithGenericNestedClass.NestedUnconstrained <string>();
     var exception = Assert.Throws <InvalidOperationException>(() => {
         var value = "";
         sample.DisallowedNullAndNotNullRefValue(ref value);
     });
 }
Exemple #2
0
    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);
    }
Exemple #4
0
    public void PropertySetterThrowForNestedGenericWithDisallowNull()
    {
        var sample = new ClassWithGenericNestedClass.NestedUnconstrained <string>();

        Assert.Throws <ArgumentNullException>(() => sample.PossiblyNullPropertyWithDisallowNull = null);
    }