views:

31

answers:

1

We're working with some very large config files which contain lots of Unity and WCF configuration.

When we open some of these configs in the SVC config editor or even try to open a web application using these configs, we recieve errors showing any typos or errors. E.g. a WCF binding is invalid or does not exist etc, or a configuration section does not exist, two endding tags, etc.

Is there some way to "valid" a config through a unit test? So there's one less thing which could go wrong when the application is moved into a new environment.

+1  A: 

You could write a set of functions that would operate on XML. It is pretty easy to find out if all sections in the file are declared, if specific binding parameters are set. If the file cannot be loaded it means the whole XML is invalid. You can use SelectSingleNode and SelectNodes with XPath expressions.

Piotr Rodak