Skip to content

Commit

Permalink
test: failing unit test using param array without TheoryData
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwoods-7 committed Apr 12, 2024
1 parent f2dd723 commit ada7c66
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Xunit;
using Verify = CSharpVerifier<Xunit.Analyzers.TheoryDataRowArgumentsShouldBeSerializable>;
Expand Down Expand Up @@ -220,4 +221,24 @@ public class PossiblySerializableUnsealedClass {{ }}";

await Verify.VerifyAnalyzerV3(LanguageVersion.CSharp8, source, expected);
}

[Fact]
public async Task ParamArrayArguments_NotUsingTheoryData_DoesNotTrigger()
{
var source = @"
#nullable enable
public class Foo {
public Foo(params object[] args) { }
}
public class TestClass {
public void TestMethod() {
var foo = new Foo(new object());
}
}
";

await Verify.VerifyAnalyzerV3(LanguageVersion.CSharp8, source);
}
}

0 comments on commit ada7c66

Please sign in to comment.