Urago
Urago

Reputation: 47

XUnit change arguments based on environment

is there a way to change arguments in XUnit Theory based on environment?

I want to have different arguments for development and production environment for the same tests.

Is there some way?

Thank you

Upvotes: 0

Views: 279

Answers (1)

schwendler
schwendler

Reputation: 66

Isn't a good pratice change de values for tests if it's unit tests. I think is the same for integration tests. But you can define values in appsetting for test project and get this values using ClassData.

    [Theory]
    [ClassData(typeof(ScenariosClass))]
    public void Method_Test(ScenariosClass data)
    {
     ....
    }

Creating strongly typed xUnit theory test data with TheoryData

Upvotes: 1

Related Questions