How to: Upgrade Database Unit Tests from Previous Releases of Database Edition

If you try to rebuild unit tests that you created in a previous release of Visual Studio Team System Database Edition, build errors will appear. You must update your project to use updated assembly names and namespaces. After you have made several simple changes, you can rebuild and run your unit tests.

You must make three sets of changes:

  • Change the assembly references to reference a new assembly.

  • Change your code so that the imports or using statements reflect the updated namespaces.

  • Change your code so that any references to types defined in the referenced namespaces reflect the updated namespaces.

To update assembly references for your unit test project

  1. In Solution Explorer, expand the References folder in the unit test project that you want to update.

  2. Right-click the Microsoft.VisualStudio.TeamSystem.Data.UnitTesting reference, and then click Remove.

  3. Right-click the References folder, and then click Add Reference.

  4. On the list on the .NET tab, click Microsoft.Data.Schema.UnitTesting.

  5. Click OK.

    Next, you will update the code to update all references to the updated namespaces.

To update the code in your unit test project

  1. In Solution Explorer, right-click DatabaseSetup.vb (if your project was created by using Visual Basic) or right-click DatabaseSetup.cs (if your project was created by using Visual C#), and then click View Code.

  2. In the code editor, replace all references to Microsoft.VisualStudio.TeamSystem.Data.UnitTesting with Microsoft.Data.Schema.UnitTesting.

    Note

    This includes updating Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions to be Microsoft.Data.Schema.UnitTesting.Conditions.

  3. For each class in your database unit test project, view the code in the code editor, and replace all references to Microsoft.VisualStudio.TeamSystem.Data.UnitTesting with Microsoft.Data.Schema.UnitTesting.

    Note

    This includes updating Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Conditions to be Microsoft.Data.Schema.UnitTesting.Conditions.

  4. On the File menu, click Save All.

    You can now rebuild your database unit test projects, and any errors related to the upgrade should be resolved. If your unit tests are using custom unit test conditions, you will also have to upgrade those before your tests will run successfully.

See Also

Tasks

How to: Upgrade a Custom Test Condition from a Previous Release

Concepts

Upgrading Database Projects from Previous Releases of Database Edition