It would be extremely helpful to have an example unit test and/or integration test to see how this all fits together.