How to perform LOCALDB integration testing in ASP. NET 5 and Xunit.net

Source: Internet
Author: User
Tags xunit

Today's continuation of yesterday's topic-Unit testing, however, is a unit test in ASP. NET 5.

In the current visual Studio CTP6, MSTest is not supported for unit testing of ASP. NET 5 projects. Therefore, for unit testing (or integration testing) of ASP. NET 5, you need to introduce other test frameworks, such as xunit.net.

Introducing Xunit.net is simple, adding Xunit.net's NuGet package (add the following in the Package.json file):

"Xunit": "2.1.0.0-beta1-build2945",

"Xunit.runner.aspnet": "2.1.0.0-beta1-build60",

"Xunit.runner.visualstudio": "2.1.0.0-beta1-build1051"

To integrate LOCALDB in your tests, you typically divide it into 3 steps:

  1. Copy the SQL from the build database to a deployment item. This article provides a sample code for the Itemdeployment class to do this thing.
  2. Execute SQL to create the database. This article provides a sample code for the LocalDB class to complete this thing.
  3. The data in the database is accessed in the test code to verify correctness.

Because the code is more complex, I do not post here, interested readers jump to the article to see it.

Original address: http://blog.developers.ba/localdb-for-database-integration-testing-in-asp-net-5-project-and-xunit-net/

How to perform LOCALDB integration testing in ASP. NET 5 and Xunit.net

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.