Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-r-g committed May 15, 2023
1 parent 495bda0 commit cd56bee
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions SboxAnalyzers.Test/ServerCmdAnalyzerUnitTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using VerifyCS = SboxAnalyzers.Test.CSharpAnalyzerVerifier<SboxAnalyzers.ServerCmdAnalyzer>;

namespace SboxAnalyzers.Test;

[TestClass]
public class ServerCmdAnalyzerUnitTest
{
[TestMethod]
public async Task Error_ServerCommandParameter()
{
var test = @"
using System;
public static class ConCmd
{
[AttributeUsage( AttributeTargets.Method )]
public class ServerAttribute : Attribute
{
}
}
public class Test
{
[ConCmd.Server]
public void Test1( {|#0:object|} obj )
{
}
}";

var expected = VerifyCS.Diagnostic( Diagnostics.ServerCmd.UnsupportedId )
.WithLocation( 0 )
.WithArguments( "System.Object" );
await VerifyCS.VerifyAnalyzerAsync( test, expected );
}
}

0 comments on commit cd56bee

Please sign in to comment.