YUNOVA · C#
Module 13: Professional practice
Unit testing with xUnit
Key points
- xUnit marks tests with [Fact] and data-driven tests with [Theory].
- Assert methods check results, such as Assert.Equal.
- Each test gets a new class instance, so tests stay isolated.
Dependency injection in .NET
Key points
- DI passes dependencies in through constructors instead of creating them.
- Services are registered as transient, scoped or singleton.
- The built-in container resolves registered services automatically.
SOLID principles in C#
Key points
- SOLID is five design principles for maintainable classes.
- Single responsibility: a class should have one reason to change.
- Depend on abstractions such as interfaces, not concrete classes.
Design patterns in C#
Key points
- Design patterns are reusable solutions to common design problems.
- Creational patterns include Factory and Singleton.
- Strategy and Observer are common behavioural patterns.