This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClassTests | |
{ | |
public class Method1 : MyClassTestsBase | |
{ | |
[Theory] | |
[AutoData] | |
public async Task Should_return_A_when_X(parameters) | |
{ | |
//! Arrange | |
// ... | |
//! Act | |
// ... | |
//! Assert | |
// ... | |
} | |
[Theory] | |
[AutoData] | |
public async Task Should_throw_B_when_Y(parameters) | |
{ | |
//! Arrange | |
// ... | |
//! Act | |
// ... | |
//! Assert | |
// ... | |
} | |
} | |
public class Method2 : MyClassTestsBase | |
{ | |
[Fact] | |
public async Task Should_return_A_when_X() | |
{ | |
//! Arrange | |
// ... | |
//! Act | |
// ... | |
//! Assert | |
// ... | |
} | |
[Fact] | |
public async Task Should_throw_B_when_Y() | |
{ | |
//! Arrange | |
// ... | |
//! Act | |
// ... | |
//! Assert | |
// ... | |
} | |
} | |
public abstract class MyClassTestsBase | |
{ | |
protected readonly MyClass Instance; | |
protected readonly IDependency1 Dependency1; | |
protected readonly IDependency2 Dependency2; | |
protected UserManagerTestsBase() | |
{ | |
Dependency1 = Substitute.For<IDependency1>(); | |
Dependency2 = Substitute.For<IDependency2>(); | |
Instance = new MyClass(IDependency1, IDependency2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment