You can check two things:
- State changes after calling void method (state check)
- Interaction with dependencies during the void method call (interaction testing)
The first approach is simple (NUnit example):
var sut = new Sut(); sut.Excercise(foo); Assert.That(sut.State, Is.EqualTo(expectedState));
The second approach requires mocks (Moq pattern):
var dependencyMock = new Mock<IDependency>(); dependencyMock.Setup(d => d.Something(bar));
Well, you can also test if appropriate exceptions are selected.
source share