Skip to content

mmalvik/NET-API-Testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Intro

This is a sample repo for setting up API testing in .NET.

It includes:

  • Demonstrating mocking services
  • Getting application logs into test output by using xUnit's ITestOutputHelper
  • Using Testcontainers to run tests against a real SQL Server

Setup

Running the API

  1. Run the SQL Server compose file:
docker-compose -f docker-compose.sqlserver.yaml up
  1. Build and run API through Visual Studio, Rider or command line.

Running the tests

  1. Make sure you have Docker running.

  2. Run the tests

Resources

Notes

EF Core in-memory provider

The EF Core in-memory provider is NOT recommended for use in integration testing:

EF Core also comes with an in-memory provider. Although this provider was originally designed to support internal testing of EF Core itself, some developers use it as a database fake when testing EF Core applications. Doing so is highly discouraged.

Source: https://docs.microsoft.com/en-us/ef/core/testing/choosing-a-testing-strategy#in-memory-as-a-database-fake

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages