• Stars
    star
    321
  • Rank 130,752 (Top 3 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example of integration testing ASP.NET Core Minimal hosting and APIs

Integration Testing ASP.NET Core Minimal APIs

Build status

Introduction

This sample project demonstrates techniques you can use for integration testing an ASP.NET Core web application that uses the minimal APIs feature.

The system-under-test used by the sample implements a simple Todo list application with ASP.NET Core using the following technologies:

The tests show how you can write integration tests for the API and User Interface layers of an application that can help you get good coverage of the system-under-test, as well as help give you confidence that the changes you make to an application are ready to ship to a production system.

The tests include demonstrations of the use of the following open source libraries and technologies:

Debugging

To debug the application locally outside of the integration tests, you will need to create a GitHub OAuth app to obtain secrets for the GitHub:ClientId and GitHub:ClientSecret options so that the OAuth user authentication works and you can log into the Todo App UI.

πŸ’‘ When creating the GitHub OAuth app, use https://localhost:5001/sign-in-github as the Authorization callback URL.

⚠️ Do not commit GitHub OAuth secrets to source control. Configure them with User Secrets instead.

Building and Testing

Compiling the application yourself requires Git and the .NET SDK to be installed (version 7.0.100 or later).

To build and test the application locally from a terminal/command-line, run the following set of commands:

git clone https://github.com/martincostello/dotnet-minimal-api-integration-testing.git
cd dotnet-minimal-api-integration-testing
./build.ps1

Feedback

Any feedback or issues can be added to the issues for this project in GitHub.

Acknowledgements

Thanks to David Fowler (@davidfowl) from the ASP.NET Core team for helping out with resolving issues with Minimal Actions found from testing this sample with the ASP.NET Core 6 pre-releases!

Repository

The repository is hosted in GitHub: https://github.com/martincostello/dotnet-minimal-api-integration-testing.git

License

This project is licensed under the Apache 2.0 license.

More Repositories

1

xunit-logging

Logging extensions for xunit
C#
249
star
2

sqllocaldb

SQL LocalDB Wrapper is a .NET library providing interop with the Microsoft SQL Server LocalDB Instance API
C#
226
star
3

SignInWithAppleSample

A sample implementation of Sign in with Apple using ASP.NET Core
C#
45
star
4

lambda-test-server

A NuGet package that provides an in-memory test server for testing AWS Lambda functions
C#
31
star
5

dotnet-bumper

Upgrades projects to a newer version of .NET
C#
25
star
6

dotnet-playwright-tests

.NET tests using Playwright
C#
24
star
7

update-dotnet-sdk

A GitHub Action that updates the .NET SDK
TypeScript
18
star
8

dependabot-helper

An application that helps manage Dependabot updates across multiple repositories.
C#
14
star
9

alexa-london-travel-site

The companion site for the London Travel Amazon Alexa skill
C#
14
star
10

website

Martin Costello's website
C#
13
star
11

adventofcode

Solutions for Advent of Code in C#
C#
11
star
12

costellobot

GitHub automation for my repositories.
C#
10
star
13

apple-fitness-workout-mapper

Visualise multiple journeys from Apple Fitness on a map
C#
9
star
14

applepayjs-typings

TypeScript typings for Apple Pay JS
TypeScript
9
star
15

dotnet-macos-notarization-example

An example of implementing notarization for a self-contained .NET application on macOS
PowerShell
9
star
16

polly-rate-limiting

An example of using Polly's RateLimit policy in a ASP.NET Core Minimal API
C#
9
star
17

antiforgery-testing-application-part

Sample application for integration testing ASP.NET Core applications using antiforgery protections
C#
8
star
18

browserstack-automate

.NET client for the BrowserStack Automate REST API
C#
8
star
19

alexa-london-travel

An Amazon Alexa skill for checking the status of travel in London
C#
8
star
20

MinimalApisWithJsonSourceGenerator

Sample application that uses the .NET 6 JSON source generator with Minimal APIs
C#
8
star
21

api

Martin Costello's API
C#
7
star
22

dotnet-core-selenium-tests

A simple test implemented in .NET Core for Selenium
C#
7
star
23

update-static-assets

A GitHub Action that updates HTML static assets
TypeScript
6
star
24

openapi-extensions

Extensions for Microsoft.AspNetCore.OpenApi
C#
6
star
25

aspnetcore-openapi

A demonstration of different ways to add OpenAPI (Swagger) support to ASP.NET Core applications
C#
5
star
26

rebaser

A GitHub Action that can resolve basic version conflicts between Git branches
TypeScript
5
star
27

aspnet-core-pseudo-localization

An example application that demonstrates using pseudo-localization with ASP.NET Core
C#
5
star
28

dotnet-patch-automation-sample

Sample repository that demonstrates automated monthly patching of .NET applications
C#
5
star
29

dotnet-8-samples

Samples for new features in .NET 8
C#
4
star
30

project-euler

My solutions for problems on https://projecteuler.net/
C#
3
star
31

aspnet-core-7-samples

Samples for ASP.NET Core 7
C#
3
star
32

presentations

Content for public presentations πŸ›
3
star
33

crank-sandbox

A sandbox for playing with the crank .NET performance testing tool
PowerShell
3
star
34

benchmarks-dashboard

A dashboard for visualising benchmark results from benchmarkdotnet-results-publisher
C#
2
star
35

wait-for-nuget-package

Waits for a new version of a NuGet package to be published
C#
2
star
36

dotnet-lambda-annotations

Playground repo for Amazon.Lambda.Annotations
C#
2
star
37

benchmarks-demo

Demonstrates continuous benchmarking in GitHub Actions using BenchmarkDotNet
C#
2
star
38

twitterarchiveparser

Parses the JSON of Twitter archives
C#
2
star
39

Refit-Json-Benchmarks

Benchmarks for (de)serializing JSON using Refit
C#
2
star
40

credit-card-splitter

An application to split parts of a credit card bill between two people
JavaScript
2
star
41

blog

Martin Costello's blog
HTML
1
star
42

cdn

Source content for my CDN
1
star
43

nugetpackagestidier

Tidies up NuGet packages in your local NuGet package folders.
C#
1
star
44

polly-sandbox

A sandbox repository for integrating Polly
C#
1
star
45

martincostello

Martin Costello's README
1
star
46

azure-functions

Contains custom Azure Functions
C#
1
star
47

Update-DotNet-Core-SDK

A PowerShell script that can be used by GitHub Actions to keep your .NET SDK up-to-date
PowerShell
1
star
48

bootstrap

Scripts to setup a new computer
PowerShell
1
star
49

benchmarks

Repository for storing benchmark results
1
star
50

benchmarkdotnet-results-publisher

A GitHub Action that publishes results from BenchmarkDotNet benchmarks to a GitHub repository
TypeScript
1
star
51

github-automation

GitHub automation
TypeScript
1
star