Is it possible to mock the corporate library of version 5 of the Database? If so ... how?
There is no IDatabase interface (which is a mystery, because although Microsoft P & P will be more on the ball about the benefits of testing that demonstrate such an interface).
I have a repository class that used the EntLib 5 Application Application Block.
I am testing modular installations in this class and need to wear out depending on the database object. This class is now passed through the database through its constructor and uses the Database object to perform operations on Db.
I use the following to allow the database instance to be transferred to my repository:
Container.RegisterType<IFooRepository, FooRepository>( new InjectionConstructor( EnterpriseLibraryContainer.Current.GetInstance<Database>("FooDbConnStr") ) );
I do not want these unit tests to become integration tests.
I tried using Moq to create a dynamic layout of the database type, but it turned out to be difficult, because the database requires a connection string and DbProviderFactory in its constructor. Perhaps if there was such a thing as a MockDbProviderFactory.
This is the form unit test takes:

In addition, I also find that using a static logger is very difficult to verify. I hope I missed some trick here, but I must say that so far I am disappointed with testability.
holsee
source share