lundi 1 août 2016

Nunit TestCaseSource skips some cases

I'm wokring on C# program, VS2015, R#, Nunit. I have Nunit tests

    [ Test ]
    [ TestCaseSource( typeof( GeneralTestCases ), "TestStoresCredentials" ) ]
    public void PingSoapAsync_IncorrectUrl_ThrowException( ServiceSoapCredentials credentials )

and

    [ Test ]
    [ TestCaseSource( typeof( GeneralTestCases ), "TestStoresCredentials" ) ]
    public void PingSoapAsync_IncorrectApiUser_ThrowException( ServiceSoapCredentials credentials )

GeneralTestCases is (there are 5 cases!!!):

public class GeneralTestCases
{
    /// <summary>
    /// GetTestStoresCredentials shoud return the same credentials as this method
    /// </summary>
    /// <returns></returns>
    public IEnumerable TestStoresCredentials
    {
        get
        {
            yield return new TestCaseData(new BaseTest.MServiceSoapCredentials()).SetName("m1-9-2-0-ce");
            yield return new TestCaseData(new BaseTest.MServiceSoapCredentials()).SetName("m1-9-2-1-ce");
            yield return new TestCaseData(new BaseTest.MServiceSoapCredentials() ).SetName("m1-9-2-2-ce");
            yield return new TestCaseData(new BaseTest.MServiceSoapCredentials() ).SetName("m2-0-2-0-ce");
            yield return new TestCaseData(new BaseTest.MServiceSoapCredentials() ).SetName("m1-8-1-0-ce");
        }


    }
}

but when i press "Run All Tests" not all cases used by Resharper test runner:

enter image description here

What i'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire