public Task RequiresNonNullMethodReturnValueWhenNullableReferenceTypeNotUsedInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); var exception = Assert.Throws <InvalidOperationException>(() => sample.MethodWithReturnValue(true)); return(Verifier.Verify(exception.Message)); }
public void RequiresNonNullArgumentWhenNullableReferenceTypeNotUsedInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); var exception = Assert.Throws <ArgumentNullException>(() => { sample.SomeMethod(null, ""); }); Assert.Equal("nonNullArg", exception.ParamName); }
public void AllowsNullArgumentAndReturnValueForNullableClassConstrainedGeneric() { var sample = new ClassWithNullableContext2(); var result = sample.GenericNullableClassWithNotNullableParam <string>(null); Assert.Null(result); }
public void PropertyGetterReturnsValueForNonNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); var value = new Tuple <string, string>("a", "b"); sample.MixedNonNullProperty = value; Assert.Equal(value, sample.MixedNonNullProperty); }
public void PropertyGetterReturnsValueForNonNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); const string value = "Test"; sample.NonNullProperty = value; Assert.Equal(value, sample.NonNullProperty); }
public void PropertyGetterThrowsOnNonNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); Assert.Throws <InvalidOperationException>(() => { var dummy = sample.MixedNonNullProperty; }); }
public void PropertyGetterReturnsNullForNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); Assert.Null(sample.NullProperty); }
public void PropertySetterAllowsNullArgumentForNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); sample.NullProperty = null; }
public void PropertySetterThrowsOnNullArgumentForNonNullableTypeInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); Assert.Throws <ArgumentNullException>(() => sample.MixedNonNullProperty = null); }
public void AllowsNullReturnValueWhenStaticNullableReferenceTypeUsedInClassWithNullableContext2() { Assert.Null(ClassWithNullableContext2.StaticMethodAllowsNullReturnValue("")); }
public void AllowsNullReturnValueWhenNullableDisabledInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); Assert.Null(sample.MethodWithNullableContext0()); }
public void AllowsNullReturnValueWhenNullableReferenceTypeUsedInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); sample.MethodAllowsNullReturnValue(); }
public void AllowsNullWithoutAttributeWhenNullableReferenceTypeUsedInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); sample.MethodWillNullableArg(null); }
public void AllowsNullWhenNullableReferenceTypeUsedInClassWithNullableContext2() { var sample = new ClassWithNullableContext2(); sample.SomeMethod("", null); }
public void RequiresNonNullReturnForNotNullReturnValue() { var sample = new ClassWithNullableContext2(); var exception = Assert.Throws <InvalidOperationException>(() => { sample.GenericNotNullReturnValue <string>(); }); }