If you are stuck using MSTest as your unit testing framework you may run into problems if any of your tests depend on external files.
MSTest creates a TestResults directory:
A directory made up of your login name, computer name and a timestamp:
and a In and an Out directory:
MSTest then copies all referenced assemblies to the Out directory and runs the tests in that directory. The problem is that MSTest does not recognize any XML configuration files (besides App.config) as dependencies and they are not copied to the Out directory so your test fails.
To remedy this you need to specify your external dependency as a deployment item in an attribute at the beginning of your test and specify the path to the deployment item:
[TestMethod]
[DeploymentItem("WindsorTestConfiguration.xml")]
public void ShouldUseDependencies()
{
IWindsorContainer container = new WindsorContainer(new XmlInterpreter(@"WindsorTestConfiguration.xml"));
Assert.IsNotNull(container);
}
Theme design by Jelle Druyts
Pick a theme: BlogXP business calmBlue Candid Blue dasBlog dasblogger DirectionalRedux Discreet Blog Blue Elegante essence Just Html MadsSimple Mobile Mono Movable Radio Blue Movable Radio Heat nautica022 orangeCream Portal Project84 Project84Grass Slate Sound Waves Tricoleur useit.com Voidclass2 BlogXP business calmBlue Candid Blue dasBlog dasblogger DirectionalRedux Discreet Blog Blue Elegante essence Just Html MadsSimple Mobile Mono Movable Radio Blue Movable Radio Heat nautica022 orangeCream Portal Project84 Project84Grass Slate Sound Waves Tricoleur useit.com Voidclass2
Powered by: newtelligence dasBlog 2.0.7226.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Steven Rockarts
E-mail