Relative paths and other problems with unit-testing ASP.NET services

suyitno

New Member
I want to create unit tests for a number of ASP.NET web services, but I'm having problems setting everything up.My first problem is setting up relative paths; since I'm not the only person who's going to work on this project, I do NOT want to add absolute paths in the attributes for the unit tests.Here's what I currently have:\[code\] [TestMethod()] [HostType("ASP.NET")] [DeploymentItem("TestData.mdf")] [DataSource("System.Data.SqlClient", @"Data Source=.\SQLEXPRESS;AttachDbFilename=.\TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True", "SumTest", DataAccessMethod.Random)] [AspNetDevelopmentServerHost(@"%SolutionPath%\ProfessionalServices.Web", "/")] [UrlToTest("http://localhost:52158/")] public void DeleteAllItemSumsTest() { Debugger.Launch(); DataDomainService target = new DataDomainService(); // TODO: Initialize to an appropriate value target.DeleteAllItemSums(); Assert.Inconclusive("A method that does not return a value cannot be verified."); }\[/code\]The main problem is that I cannot connect to the database file. If I specify an absolute path in \[code\]DataSource\[/code\], it'll work. But, as I wrote earlier, I want to use a relative path.My second issue, is that I cannot connect a debugger to the tests! It seems it doesn't attach to the development server. Worse still, even with the \[code\]Launch()\[/code\] method, I cannot use the same instance of Visual Studio I've already got opened for some reason, and a new instance is missing code-completion while debugging.What's going on here? :-/
 
Back
Top