My question is How to setup multiple fixtures in one test class?
But the constructor of Zoo class can not handle multiple fixtures.
For exemple:
public class Zoo : IClassFixture<Tiger>, IClassFixture<Wolf>, IClassFixure<Bird>
{
private IFixture fixture;
public Zoo(IFixture fixture)
{
this.fixture = fixture;
}
[Fact]
public void TestAnimal()
{
//Arrange
int actualBonesCount = this.fixture.BonesCount;
int expectedBonesCount = 2;
//Act & Assert
Assert.Equal(expectedBonesCount, actualBonesCount );
}
}
A tiger class
public class Tiger : FixtureBase
{
public Tiger()
{
this.BonesCount = 4;
}
}
A bird class
public class Bird: FixtureBase
{
public Bird()
{
this.BonesCount = 2;
}
}
Test fixture base class
public class FixtureBase : IFixture
{
public int BonesCount { get; set; }
}
And interface
public interface IFixture
{
int BonesCount { get; set; }
}