Skip to content

TestCaseSource "Single" cannot be converted to "int" issue #3125

@eberzosa

Description

@eberzosa

I don't know if this is an issue or a feature :) but a TestCaseSource cannot be used in two methods with different parameter types, in the following case, the second test fails with

Object of type 'System.Single' cannot be converted to type 'System.Int32'

   class Test
   {
      private static readonly TestCaseData[] Cases =
      {
         new TestCaseData("", 0),
         new TestCaseData("", 1)
      };
      
      [TestCaseSource(nameof(Cases))]
      public void TestA(string a, float b)
      {
      }

      [TestCaseSource(nameof(Cases))]
      public void TestB(string a, int b)
      {
      }
   }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions