I am wondering what the life spane of a dynamic mock is.
The lifespan of any mocked type is until you do one of the following:
mock.Verify()
mock.Clear()
MockManager.Verify() -> This verifies ALL mocks
MockManager.Init() -> This clears all mocks
If you create a mock in the TestFixtureSetup, make sure that this mock is Verified in the TestFixtureTearDown. All other mocks should be implicitly verified. The rule is to MockManager.Verify in the same scope as the MockManager.Init.
Remember that if you don't clear or verify the mock it will still be enabled for the next tests that you are doing (This might have a bad effect on your tests if you don't expect the types to be mocked).
Also remember that MockManager.Init() clears all the mocks.
So in your case I would do the following:
1. MockManager.Init() in the [TestFixtureSetup]
2. Create the ConnectionProvider mock in [TestFixtureSetup]
3. (optional) Create other mocks in the [Setup] and [Test]
4. (optional) Verify other mocks in [TearDown] and [Test]
5. MockManager.Verify() in the [TestFixtureTearDown]