Giter Site home page Giter Site logo

yogyogi / asp.net-core-unit-testing-with-xunit Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 12.0 37.52 MB

How to perform Unit Testing with xUnit in ASP.NET Core

Home Page: https://www.hosting.work/aspnet-core-xunit-unit-testing/

C# 72.38% HTML 18.85% CSS 8.35% JavaScript 0.43%
xunit aspnetcore unit-testing unit-test moq testing integration-testing ui-testing selenium selenium-webdriver

asp.net-core-unit-testing-with-xunit's Introduction

ASP.NET Core Unit Testing with xUnit

I perform Unit Testing for my ASP.NET core app with xUnit framework. These are divided into 6 topics:

  1. Unit Testing with xUnit in ASP.NET Core
  2. Moq and xUnit for Unit Testing Controllers in ASP.NET Core
  3. Unit Testing of Web API with xUnit and Moq
  4. How to tests Entity Framework Core Codes
  5. How to perform Integration Testing in ASP.NET Core
  6. Automated UI Testing with Selenium in ASP.NET Core

I have also written separate tutorials for each of these 6 types of tests. Kidly refer them.

Tutorial 1

How to perform Unit Testing with xUnit in ASP.NET Core

Contents

  1. Fact, Theory, InlineData
  2. Project Setup
  3. Adding Project for Unit Testing
  4. Adding Project Reference
  5. Adding xUnit Packages
  6. Testing a C# class functionality in xUnit
  7. Arrange, Act, Assert
  8. Running the Test in Test Explorer
  9. [Theory] and [InlineData] attributes
  10. Assert class Important Methods
  11. Testing Controller with xUnit
  12. Writing Test Methods for controllers in xUnit
  13. How to Debug Test Methods with Breakpoints

Tutorial 2

How to use Moq and xUnit for Unit Testing Controllers in ASP.NET Core

Contents

  1. Setup
  2. Moq
  3. In Memory Database
  4. Creating Database Operations Class
  5. Creating a Simple CRUD Operations feature in ASP.NET Core
  6. Testing Controller with Moq and xUnit
  7. Unit Tests for “Create” actions
  8. Unit Tests for “Read” action
  9. Unit Tests for “Update” action
  10. Unit Tests for “Delete” action

Tutorial 3

Unit Testing of Web API with xUnit and Moq

Contents

  1. Project setup install xUnit and Moq
  2. Create Web API
  3. Testing Web API with xUnit and Moq

Tutorial 4

How to tests Entity Framework Core Codes

Contents

  1. Setup of the App and In-Memory database for Testing
  2. In Memory Database
  3. Database Context and Model class
  4. Creating a Simple CRUD Operations feature in ASP.NET Core
  5. Testing Controller with xUnit
  6. Seeding the Database
  7. Unit Tests for “Create” actions
  8. Unit Tests for “Read” action
  9. Unit Tests for “Update” action
  10. Unit Tests for “Delete” action

Tutorial 5

How to perform Integration Testing in ASP.NET Core

Contents

  1. Project Setup
  2. Creating Test Server with WebApplicationFactory class
  3. Integration Test Class
  4. Integration Testing of the Read Action
  5. Integration Testing of the CREATE Action (HTTP GET type)
  6. Invalid Model – Integration Testing of the CREATE Action (HTTP POST type)
  7. Valid Model – Integration Testing of the CREATE Action (HTTP POST type)
  8. AntiForgeryToken in Integration Testing
  9. How to include AntiForgeryToken in Integration Testing
  10. Modify the Integration Test for ValidateAntiForgeryToken

Tutorial 6

Automated UI Testing with Selenium in ASP.NET Core

Contents

  1. Project Setup and Selenium Installation
  2. Writing UI tests with Selenium
  3. UI Test to Check if the View is rendered
  4. UI Test to Check browser behaviour when Model is invalid
  5. UI Test to Check browser behaviour for Valid Model

Want to support me ?

Your support of every $5 will be a great reward for me to carry on my work. Thank you!

Buy Me A Coffee Paypal Me

asp.net-core-unit-testing-with-xunit's People

Contributors

yogyogi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.