Skip to content

Type args are not deduced correctly for parameterized fixtures #4243

Description

@estrizhok

NUnit 3.13.1

Consider the following test class (from your own codebase):

[Category("Generics")]
[TestFixture(100.0, 42)]
[TestFixture(42, 100.0)]
public class DeduceTypeArgsFromArgs<T1, T2>
{
    T1 t1;
    T2 t2;

    public DeduceTypeArgsFromArgs(T1 t1, T2 t2)
    {
        this.t1 = t1;
        this.t2 = t2;
    }

    [TestCase(5, 7)]
    public void TestMyArgTypes(T1 t1, T2 t2)
    {
        Assert.That(t1, Is.TypeOf<T1>());
        Assert.That(t2, Is.TypeOf<T2>());
    }
}

Expected type args:

  1. System.Double, System.Int32
  2. System.Int32, System.Double

Actual type args:

  1. System.Double, System.Double
  2. System.Double, System.Double

P.S. I fixed it (and wrote tests) but could not commit to a new branch in your repository so as I could make a pull request. How do I do that?

remote: Permission to nunit/nunit.git denied to estrizhok.
fatal: unable to access 'https://github.com/nunit/nunit.git/': The requested URL returned error: 403

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions