public async Task StopAsyncHappyPath() { var mockReceiver = new Mock <IReceiver>() .SetupProperty(m => m.MessageHandler); var database = new Mock <IDatabase>().Object; var service = new ExampleService(mockReceiver.Object, database); await service.StartAsync(CancellationToken.None); await service.StopAsync(CancellationToken.None); mockReceiver.Verify(m => m.Dispose(), Times.Once()); }