AutoFixture: PropertyData and heterogeneous parameters

前端 未结 1 1399
情话喂你
情话喂你 2020-12-20 22:59

Given the following test:

[Theory]
[PropertyData(\"GetValidInputForDb\")]
public void GivenValidInputShouldOutputCorrectResult(
    string patientId
    , st         


        
相关标签:
1条回答
  • 2020-12-20 23:38

    You need to supply data to the PropertyDataAttribute as below:

    public static IEnumerable<object[]> GetValidInputForDb 
    {
        get
        {
            yield return new object[]
            {
                "123", 
                "abc"
            };
        }
    }
    

    The patientId value will be 123, the patientFirstName value will be abc and the SUT value is going to be supplied automatically by AutoFixture.

    The CustomPropertyDataAttribute looks good.

    0 讨论(0)
提交回复
热议问题