MiniSpec Syntax Example
// Feel free to use Xunit or NUnit assertions with MiniSpec.
// You don't even need to reference MiniSpec from your project.
using Xunit;
class AnimalTests {
Animal animal;
// Tests may be class methods (instance or static)
bool TestDefaultAnimalSound => animal.MakeSound() is null;
// Or tests may be grouped *within* class methods
void DogTests() {
animal = new Dog(); // <-- setup can be performed here
bool ItBarks => Assert.Equal("Woof!", animal.MakeSound())
void ItCanSit() {
Assert.Equal(DogStances.Standing, animal.Stance);
animal.Sit();
Assert.Equal(DogStances.Sitting, animal.Stance);
}
}
void CatTests() {
animal = new Cat();
bool ItMeows => Assert.Equal("Meow!", animal.MakeSound())
}
}
Writing a Red Test Choosing a Style to Implement