© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•5mo ago•
29 replies
Anton Galkin

xUnit `MemeberData` function with parameters raises a type error

I am trying to run tests, where I generate a varying number of inputs for my tests. Please help me achieve this. I have been unsuccessful with my current implementation (image), and I am willing to hear how I could improve or redo this. I have no problem starting from scratch.

See code attached in image.

When I run this test however, I get an error message saying that the parameter
2
2
was not compatible with the type of the value that is passed to
GetNTuples
GetNTuples
. The specific type error I when I try to run the test is:
Starting test run
[Failed] Calculator.Core.Tests.TestExactUint.Equality
    Message:
        System.ArgumentException : Could not find public static member (property, field, or method) named 'GetNTuples' on Calculator.Core.Tests.TestExactUint with parameter types: System.Int32

==== Summary ====
Failed!  - Failed:    1, Passed:    0, Skipped:    0, Total:    1, Duration: 175ms
Starting test run
[Failed] Calculator.Core.Tests.TestExactUint.Equality
    Message:
        System.ArgumentException : Could not find public static member (property, field, or method) named 'GetNTuples' on Calculator.Core.Tests.TestExactUint with parameter types: System.Int32

==== Summary ====
Failed!  - Failed:    1, Passed:    0, Skipped:    0, Total:    1, Duration: 175ms


Do keep in mind I had to use that pragma because the analyzer was bothering me. It resulted on the
[MemberData(...)]
[MemberData(...)]
line. I also tried to use
TheoryData
TheoryData
but I just got a different analyzer warning I didn't know how to resolve, so I ended up sticking with the the suppression of the first warning, which is what you see now. Evidently, this warning indicates something, but I don't know what.
Screenshot_From_2025-10-05_01-21-40.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Assert.Raises<> in xUnit
C#CC# / help
3y ago
✅ How do i pass a function with unknown parameters?
C#CC# / help
4y ago
Test ASP.API controller with xUnit: can't assert Type
C#CC# / help
3y ago
❔ xUnit tests
C#CC# / help
3y ago