Coder Social home page Coder Social logo

edward-teixeira / aspnetcoretests Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gpeipman/aspnetcoretests

1.0 0.0 0.0 738 KB

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

Home Page: https://gunnarpeipman.com

JavaScript 0.33% C# 82.87% CSS 2.08% HTML 13.72% Batchfile 1.01%

aspnetcoretests's Introduction

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

aspnetcoretests's People

Contributors

gpeipman avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.