public void ParseTypeParametersOpt_should_imply_types_not_arguments_when_qualified(string text) { var s = new SignatureParser("<" + text + ", U, V>"); s.MoveNext(); var data = s.ParseTypeParametersOpt(); Assert.IsNotInstanceOf(typeof(GenericParameterName), data.Raw[0]); Assert.Equal(TypeName.Parse(text), data.Raw[0]); Assert.False(data.CouldBeParameters); }
public void ParseTypeParametersOpt_should_handle_empty_list() { var s = new SignatureParser("<>"); s.MoveNext(); var result = s.ParseTypeParametersOpt(); var data = result.Raw; Assert.HasCount(1, data); Assert.Null(data[0]); Assert.True(result.MustBeParameters); }
public void ParseTypeParametersOpt_should_treat_names_as_positional(bool method) { var s = new SignatureParser("<,,>"); s.MoveNext(); var data = s.ParseTypeParametersOpt(); Assert.HasCount(3, data.Raw); var gp = data.ConvertToGenerics(method); Assert.Equal(0, gp[0].Position); Assert.Equal(1, gp[1].Position); Assert.Equal(2, gp[2].Position); Assert.Equal(method, gp[0].IsMethodGenericParameter); Assert.Equal(method, gp[1].IsMethodGenericParameter); Assert.Equal(method, gp[2].IsMethodGenericParameter); Assert.True(data.CouldBeParameters); }
public void ParseTypeParametersOpt_should_handle_names(bool method) { var s = new SignatureParser("<T, U, V>"); s.MoveNext(); var data = s.ParseTypeParametersOpt(); Assert.HasCount(3, data.Raw); Assert.Equal("T", data.Raw[0].Name); Assert.Equal("U", data.Raw[1].Name); Assert.Equal("V", data.Raw[2].Name); var gp = data.ConvertToGenerics(method); Assert.Equal(0, gp[0].Position); Assert.Equal(1, gp[1].Position); Assert.Equal(2, gp[2].Position); Assert.Equal(method, gp[0].IsMethodGenericParameter); Assert.Equal(method, gp[1].IsMethodGenericParameter); Assert.Equal(method, gp[2].IsMethodGenericParameter); Assert.True(data.CouldBeParameters); }