nunit/nunit3-vs-adapter

Splitting a test with a TestCaseSource and ignoring test cases

bookofproofs opened this issue · 1 comments

  • NUnit and NUnit3TestAdapter versions: 4.1.0, 4.5.0
  • Visual Studio edition and full version number: 17.9.5
  • What .net platform and version is being targeted (.net8)
  • A short repro, preferably attached or pointing to a git repo or gist

This is F#:

namespace FplInterpreter.Tests
open NUnit.Framework


type SomeUnion = 
    | A 
    | B

[<Class>]
type TestCaseSourceNunit() =


    static member BaseCases = [
        yield ("true", A)
        yield ("false", A)
        yield ("undef", A)
        yield ("1.", A)
        yield ("del.Test()", A)
        yield ("$1", A)
        yield ("bydef Test()", A)             
        yield ("Test$1", A)            
        yield ("Test$1()", A)            
        yield ("Test", A)        
        yield ("v", A)
        yield ("self", A)
        yield ("1", A)
        yield ("v.x", A)
        yield ("self.x", A)
        yield ("Test()", A)
        yield ("v()", A)
        yield ("self()", A)
        yield ("1()", A)
        yield ("Test(x,y)", A)
        yield ("v(x,y)", A)
        yield ("self(x,y)", B)
        yield ("1(x,y)", B)
        yield ("Test[x,y]", B)
        yield ("v[x,y]", B)
        yield ("self[x,y]", B)
        yield ("1[x.y]", B)
        yield ("Test(x,y).@self[a,b]", B)        
        yield ("v(x,y).x[a,b]", B)            
        yield ("self(x,y).3[a,b)", B)
        yield ("1(x,y).T[a,b)", B)
        yield ("Test[x,y).x(a,b)", B)
        yield ("v[x,y).x(a,b)", A)
        yield ("self[x,y).self(a,b)", B)
        yield ("1[x.y).T(a,b)", B)
        yield ("∅", B)
        yield ("-x", A)
        yield ("-(y + x = 2 * x)", B)
        yield ("(y + x' = 2 * x)'", B)
        yield ("ex x in Range(a,b), y in c, z {and (a,b,c)}", B)
        yield ("exn$1 x {all y {true}}", A)
        yield ("all x {not x}", B)
        yield ("and (x,y,z)", B)
        yield ("xor (x,y,z)", B)
        yield ("or (x,y,z)", B)
        yield ("iif (x,y)", B)
        yield ("impl (x,y)", B)
        yield ("is (x,Nat)", B)
    ]

    [<Test>]
    [<TestCaseSource("BaseCases")>]
    member this.TestBaseCase(var: string * SomeUnion) =
        Assert.That(true)

NUnit will discover 40 (instead of 48) test cases and split the TestBaseCase into five different tests:

image

I suspect this is part of the same naming issues we have on the testcases (and testcasesources). I am no F# dev, so would appreciate of you could upload a working F# project with the code above.