c# - TDD with Web Config -


All great stories, they always start with those 4 magical words ... I have got a system ... no Wait! this is not right!

Anyway, with my effort on humor now has passed, I have not given much, I have to support an existing service.

It comes to use this service, for example, to build a record of a person, you have to call 4 different parts of the services.

Therefore, in collaboration with our manager, we decided that we need it.

If anyone wants, my question starts here, to start again To add masks for common requests, to smooth the numbers and make them the correct sequence, stick another layer on the top. To avoid the above waffle

So I am working but want to use TDD, but the service which I have inherited (which will become our data layer) The connection string located in the specific connetionstring node in the web is strongly linked to. Config

I have a problem, it will take weeks for me to reduce the service from the config file, which I do not want.

So I want to add it to the expected node in my test project and the App.Config file.

Is it OK, or should I invest in some time to configure the database configuration to decouple from DotLayer?

I agree that you should use dependency injection I am doing my job through code, however, I also understand that doing this will not be an easy task.

Therefore, to answer your question directly, no, there is nothing wrong in adding a config file to support your tests. Unit Testing Legacy System (Heritage is an unprotected system ) This is actually quite normal. I also have the support to use the reflection to "inject" the duplicate configuration values ​​in the configuration manager to test the code which is reading the configuration value, even when no other option has been left, but This is probably the last resort.


Comments