• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    C#
  • Created almost 5 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

Simple, clean and minimalistic ASP.NET Core solution demonstrating unit and integration tests

AspNetCoreTests

This project is ASP.NET Core application to demonstrate my work on ASP.NET Core unit and integration tests. Projects are thin and clean having just minimal code to show how testing related issues are solved.

Unit tests

Unit tests project demonstrates the following features:

  • Unit testing controllers
    • Checking if correct view is returned
    • Faking current user correctly
  • Unit testing service classes
  • Using EF Core in-memory database for unit tests
  • Script to generate and display code coverage reports
    • run-tests.bat file runs tests and code coverage analytics
    • Look inside model classes to see how leave code out from coverage analysis

NB! You need to install report generator manually. Open unit tests project folder in command line and type the following command:

dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools

Integration tests

Although there are simpler ways to get started with ASP.NET Core integration tests, the approach here is more flexible. Integration test examples have these important features:

  • Use custom appsettings.json file for integration tests
  • Use custom web application startup class
  • Faking authenticated and authorized user
  • Support for multiple faked user accounts and roles
  • Testing with users in different roles

References

More Repositories

1

AspNetCoreMultitenant

Multitenant ASP.NET Core application to serve as a starting point for real multitenant applications
C#
194
star
2

DotNetPaging

Data paging with ASP.NET and ASP.NET Core
JavaScript
80
star
3

BlazorDemo

Demo application for my writings about Blazor
C#
78
star
4

AspNetCoreChatRoom

WebSocket based chat room built on ASP.NET Core
C#
52
star
5

Visual-Studio-Experiments

Source code of my Visual Studio experiments
JavaScript
40
star
6

AspNetCoreRealTimeChart

Example of real-time chart on ASP.NET Core using WebSocket
C#
34
star
7

AspNetCorePowerBI

Embedded Power BI reports in ASP.NET Core
C#
16
star
8

TemperatureStation

Simple temperature measuring system
CSS
16
star
9

AspNetCoreLocalization

C#
12
star
10

EFCoreGlobalQueryFilters

C#
10
star
11

CognitiveServicesDemo

Demo application for my Azure Cognitive Services Vision API presentation
JavaScript
10
star
12

ObjectToObjectMapper

Source code for my posts serie about building object-to-object mapper
C#
8
star
13

Windows-Phone-7-Experiments

My Windows Phone 7 experiments and examples
C#
6
star
14

AspNetCoreBearerTokenAuth

C#
6
star
15

Windows10IoTWebControl

Windows 10 IoT Core background task that is controllable through ASP.NET Core web application on same board.
C#
5
star
16

BlazorBeerCalculator

Blazor based offline WebAssembly application to calculate alc. vol. of beer.
JavaScript
4
star
17

DapperDemo

Samle to-do application using ASP.NET Core and Dapper
C#
4
star
18

RazorClassLibraryDemo

Example of Razor Class Library using ASP.NET Core MVC.
C#
3
star
19

AspNetCoreHelloBlinky

Source code for my ASP.NET Core 3.0 "Hello, blinky" IoT application
C#
3
star
20

HierarchyTraverser

HierarchyTraverser is universal class for traversing hierarchies.
C#
2
star
21

spfx-harjutused

SharePoint Framework (SPFx) koolituse raames tehtud harjutused
JavaScript
2
star
22

JekyllBlog

Sample static blog built on Jekyll and deployed to Azure static website using Azure DevOps
CSS
2
star
23

CSharp7

Support solution for my C# 7.x blog posts and presentation
C#
1
star
24

AspNetCoreMultiplatform

Multiplatform web application written on ASP.NET Core
C#
1
star
25

MyMobileApp

Xamarin Forms multi-platform experiments
C#
1
star
26

WindowsIotTrafficLights

Traffic lights simulator built on Windows 10 IoT Core and RaspberryPi. Implementations for Windows 10 IoT Core background task and UWP appliation.
C#
1
star