public void SingleGenericTypeParameterWithBaseTypeThenOneWithout() { var content = "<TKey extends Something, TValue>"; var expected = MatchResult.New( value: ImmutableList <GenericTypeParameterDetails> .Empty .Add(new GenericTypeParameterDetails( name: new NamedTypeDetails( name: new IdentifierDetails("TKey", new SourceRangeDetails(1, 4)), genericTypeParams: ImmutableList <GenericTypeParameterDetails> .Empty ), typeConstraint: new NamedTypeDetails( name: new IdentifierDetails("Something", new SourceRangeDetails(14, 9)), genericTypeParams: ImmutableList <GenericTypeParameterDetails> .Empty ) )) .Add(new GenericTypeParameterDetails( new NamedTypeDetails( name: new IdentifierDetails("TValue", new SourceRangeDetails(25, 6)), genericTypeParams: ImmutableList <GenericTypeParameterDetails> .Empty ), typeConstraint: Optional <NamedTypeDetails> .Missing )), reader: new StringNavigator("") ); AssertResultsMatch(expected, TypeDefinitionParsers.GenericTypeParameters(new StringNavigator(content))); }
public void BlankContent() { Assert.IsTrue( DoOptionalMatchResultsMatch( Optional <MatchResult <ImmutableList <GenericTypeParameterDetails> > > .Missing, TypeDefinitionParsers.GenericTypeParameters(new StringNavigator("")) ) ); }
public void NoLeadingBracket() { var content = "T"; Assert.AreEqual( Optional <MatchResult <ImmutableList <GenericTypeParameterDetails> > > .Missing, TypeDefinitionParsers.GenericTypeParameters(new StringNavigator(content)) ); }
public void SingleGenericTypeParameter() { var content = "<T>"; var expected = MatchResult.New( value: ImmutableList <GenericTypeParameterDetails> .Empty .Add(new GenericTypeParameterDetails( new NamedTypeDetails( name: new IdentifierDetails("T", new SourceRangeDetails(1, 1)), genericTypeParams: ImmutableList <GenericTypeParameterDetails> .Empty ), typeConstraint: Optional <NamedTypeDetails> .Missing )), reader: new StringNavigator("") ); AssertResultsMatch(expected, TypeDefinitionParsers.GenericTypeParameters(new StringNavigator(content))); }
public void Null() { TypeDefinitionParsers.GenericTypeParameters(new StringNavigator(null)); }