public void should_specify_type_if_type_argument_cannot_be_resovled() { string actualReturnValue = GenericMethodDemoClass.NotResolvableGenericMethod <string>(); // correct the variable value to fix the test const string expectedReturnValue = ""; Assert.Equal(expectedReturnValue, actualReturnValue); }
public void should_automatically_resolve_parameter_type() { string actualReturnValue = GenericMethodDemoClass.ResolvableGenericMethod(new Duck()); // correct the variable value to fix the test const string expectedReturnValue = ""; Assert.Equal(expectedReturnValue, actualReturnValue); }
public void should_specify_type_if_type_argument_cannot_be_resovled() { // string fills the type parameter, implicitly creating a type on the fly string actualReturnValue = GenericMethodDemoClass.NotResolvableGenericMethod <string>(); // correct the variable value to fix the test const string expectedReturnValue = "NotResolvableGenericMethod() called. T is String"; Assert.Equal(expectedReturnValue, actualReturnValue); }
public void should_automatically_resolve_parameter_type() { // expicitly identify the type according to argument type string actualReturnValue = GenericMethodDemoClass.ResolvableGenericMethod(new Duck()); // correct the variable value to fix the test const string expectedReturnValue = "ResolvableGenericMethod(T) called. T is Duck"; Assert.Equal(expectedReturnValue, actualReturnValue); }