Skip to content

Commit

Permalink
Add additional tests covering SyntaxKindEx features
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed May 30, 2017
1 parent e7a6881 commit 0b11e07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.Lightup
using System;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using StyleCop.Analyzers.Helpers;
using StyleCop.Analyzers.Lightup;
using Xunit;

Expand All @@ -25,6 +26,9 @@ public void TestNull()
public void TestExpression()
{
var syntaxNode = SyntaxFactory.ConstantPattern(SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression));
Assert.True(syntaxNode.IsKind(SyntaxKind.ConstantPattern));
Assert.True(syntaxNode.IsKind(SyntaxKindEx.ConstantPattern));

var constantPatternSyntax = (ConstantPatternSyntaxWrapper)syntaxNode;
Assert.Same(syntaxNode, constantPatternSyntax.SyntaxNode);
Assert.Same(syntaxNode.Expression, constantPatternSyntax.Expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.Lightup
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using StyleCop.Analyzers.Helpers;
using StyleCop.Analyzers.Lightup;
using Xunit;

Expand All @@ -30,6 +31,9 @@ public void TestProperties()
var syntaxNode = SyntaxFactory.DeclarationPattern(
SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword)),
SyntaxFactory.DiscardDesignation());
Assert.True(syntaxNode.IsKind(SyntaxKind.DeclarationPattern));
Assert.True(syntaxNode.IsKind(SyntaxKindEx.DeclarationPattern));

var declarationPatternSyntax = (DeclarationPatternSyntaxWrapper)syntaxNode;
Assert.Same(syntaxNode, declarationPatternSyntax.SyntaxNode);
Assert.Same(syntaxNode.Type, declarationPatternSyntax.Type);
Expand Down

0 comments on commit 0b11e07

Please sign in to comment.