.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Deploying SQL CE dll's for VS2010 Unit Test

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :

I'm trying to uint test the methods of a class which derives from a base class in another assembly. The base class uses Entity with SQL CE.

Normally the System.Data.SqlServerCe.dll and System.Data.SqlServerCe.Entity.dll are in the common build target directory, along with the base class assembly's dll. They don't get copied to the TestResults/<test>/Out directory. (The test assemblies do NOT target the comon build target directory; they use "bin/Release" or "bin/Debug".)

The base class assembly dll DOES get copied to the Out directory, along with other project dll's it depends on. These also have been copied to the bin/Debug (bin/Release) for the unit test project, but the SqlServerCe dll's are not there, either.

I tried using [DeploymentItem("System.Data.SqlServerCe.dll")] to copy them to the Out directory, but with no luck.

Adding the files to the Deployment list in the Test Settings, DOES copy them to Out. However, the unit test still fails in the same way... An exception is being thrown when the main entity class (derived from ObjectContext) is constructed with the connectionString.  The exception message is:

The specified store provider cannot be found in the configuration, or is not vali

View Complete Post

More Related Resource Links

Generation Test: Automated Unit Tests for Legacy Code with Pex


Creating and maintaining a unit test suite for legacy code can be a challenge. Pex automatically produces a small test suite with high code and assertion coverage.

Nikhil Sachdeva

MSDN Magazine December 2009

Unit Testing: Apply Test-Driven Development to your Database Projects


Jamie Laflen extols the benefits of TDD when applied to database development-and supplies some useful techniques along the way.

Jamie Laflen

MSDN Magazine Launch 2008

Unit Testing: Exploring The Continuum Of Test Doubles


Creating and using mock component servers simplifies unit testing. Use these examples to get started.

Mark Seemann

MSDN Magazine September 2007

Unit Testing: Mock Objects to the Rescue! Test Your .NET Code with NMock


The problem: unit testing libraries, especially data access components, that have a complex set of dependencies. The solution: providing a dynamic mock implementation of your data access classes. Here the author explains just how to make testing easier and more reliable using NMock.

Mark Seemann

MSDN Magazine October 2004

Path too long packaging or deploying SP2010 solutions in VS2010

I'm regularly getting "Error 2 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters" building projects with VS2010 for SP2010. I've done what I can to reduce the length of the path but unfortunately I have rules for the namespaces I must use. This is really frustrating and causing issues for our team trying to meet our business requirements. Is there any way to improve this situation apart from shortening the paths? (Similar to this post for the RC build: http://social.technet.microsoft.com/forums/en-us/sharepoint2010programming/thread/36D35235-6736-410F-ACC6-03C0BDCC4FE2) Thanks, Alex.Alex Angas - http://www.alexangas.com/blog

Who know some tools can help to create fake data which was used in unit test of asp.net mvc project

I was using aps.net mvc unit test, and want to create fake data instead of using real database connection, but the Linq query code and real database was huge and complicated, create fake data in unit test which can mimic real database was a huge job! Who knows some tools can help me to decrease size of real database and create mimic fake data for unit test. Thanks

Unit Test in MVC. What frameworks do you suggest?

Hello,What Unit Test Framework and Mock would you advice me for test MVC projects.Thank you,Miguel

VS2010 Deploying Database Project - Error: Cannot create file [...]MSSQL10.MSSQLSERVER\MSSQL\DATA\m

I had SQL Express from a previous installation of VS2010. I uninstalled All SQL and VS2010 and re-installed VS2010 (without Express) and then re-installed SQL Server 2008 Developer Edition. Now when I try to deploy a database project I am receiving the following error:     Creating EDDY.Cheetah.Database.Server... ...\sql\debug\Server.sql(38,0): Error SQL01268: .Net SqlClient Data Provider: Msg 5170, Level 16, State 1, Line 1 Cannot create file 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\mastlog.ldf' because it already exists. Change the file path or the file name, and retry the operation. ...\sql\debug\Server.sql(38,0): Error SQL01268: .Net SqlClient Data Provider: Msg 1802, Level 16, State 4, Line 1 CREATE

How do I unit test HttpContext



I have a class library that uses HttpContext a lot, but I am having trouble writing unit tests for the functions. e.g. System.Web.HttpContext.Current.Request.ApplicationPath always return null, that makes class library throws exceptions everywhere.  I am not allowed to change the source codes of class library, so please let me know how to write test cases against it.


How to unit test C# Web Service with Visual Studio 2010 ultimate


I have webservice running, how to test those web methods using the Test features of Visual Studio 2010.

As with normal web reference i am not able to create the classes and call the webmethods inside the test class.

Write Unit Test for method with parameter


I'm trying to build my first MVC site and also write unit test for the first time.  I can't figure how to write unit test for methods that take parameters.  How do I write a test method for this controller action?

public class CustomerController : Controller

        public ActionResult Details(int id)
            var customerDetails = (from c in _entities.Customers
                                  where c.PK == id
                                  select c).FirstOrDefault();

            return View(customerDetails);


Unit Testing Error - The unit test adapter failed to connect to the data source or to read the data


I'm using VSTS 2K8 and I've set up a Unit Test Project. In it, I have a test class with a method that does a simple assertion. I'm using an Excel 2007 spreadsheet as my data source.

My test method looks like this:

"Dsn=Excel Files;dbq=|DataDirectory|\\MyTestData.xlsx;defaultdir=C:\\TestData;driverid=1046;maxbuffersize=2048;pagetimeout=5",
public void State_Value_Is_Set()

Deploying Publishing SharePoint site from development to test and production environment.




I have created a Publishing Site in SharePoint 2010, with pages created from custom page layouts, content types and Publish Content areas which I have created using SharePoint Designer 2010.

Also, I created custom Lists, Libraries and workflows in my development environment.

I want to replicate the site in test/production environment.

Can you please suggest me the best way to package all, along with custom site settings from development environment so that I can migrate small changes to test/ production environment later also without creating .wsp as I have access to SharePoint designer 2010 only.

Abhijit Sil

Visual Studio Unit Test for Visual Web Developer 2010 Express



I am using ASP.NET MVC and want to have Unit Test functionality integrated within Visual Web Developer 2010 Express (or Visual Studio LightSwitch). Is it possible and if so, what is the recommended/best way to get it?


Custom Webpart doesn't show up in Sharepoint 2010 after deploying from VS2010

I have created a visual webpart in VisualStudio 2010 as Farm Solution and after deploying the webpart doesnt show under Categories(Custom) when i click insert webpart

Unit Test Url.Action




I have this method in a controller, but when i call from Unit test it is always null, If i run the website it works just fine.  How can i fake it so that Url.Action works
within my controller????? 

/// <summary>
        /// Set landing page URL
        /// </summary>
        /// <param name="contentSubType">Content sub type</param>
        /// <returns>Returns the landing page url</returns>
        public string GetLandingPageByContentSubType(ContentTypeLookup contentSubType)
            var landingPage = string.Empty;

            switch (contentSubType)
                case ContentTypeLookup.DesignArticle:
                    landingPage = SiteGlobalSettings.WebsiteUrl;
                    landingPage += Url.Action("DesignHome", "Design");
                case ContentTypeLookup.Product:
                    landingPage = SiteGlobalSettings.WebsiteUrl;
                    landingPage += Url.Action("ProductsHome", "Products");
                case Co

Why MVC best for UNIT test and not webforms if there is BL and Input Validation Layer?



ASP.NET MVC sessions and books say ASP.NET MVC enables to do unit testing as logic would be in controller independent to HTTP Request. So that controller can be unit tested indivisually. I do not think so people write their bussiness logic in controllers rather in seperate bussiness layer assembly. So there is no need to test controllers in bussiness perspective.

I do not think so we write web applications without a seperate Bussiness Layer. In this case Bussiness Layer also a clear seperation from UI. So BL can also be tested very well using UNIT testing frameworks either in MVC or in webforms.

then why should we chose ASP.NET MVC over WebForms in terms of UNIT Testing. Could anyone please clarify me in this regard if I'm wrong?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend