コード例 #1
0
    public void RequiresNonNullArgumentForNonNullGenericConstraint()
    {
        var sample    = new ClassWithNullableContext1();
        var exception = Assert.Throws <ArgumentNullException>(() => { sample.NotNullGeneric <string>(null); });

        Assert.Equal("nonNullArg", exception.ParamName);
    }
コード例 #2
0
 public void RequiresNonNullReturnForNonNullGenericConstraint()
 {
     var sample    = new ClassWithNullableContext1();
     var exception = Assert.Throws <InvalidOperationException>(() => { sample.NotNullGeneric <string>(""); });
 }