xUnit in ASP.NET Core MVC (edit)

  • Moq
  • FluentAssertions -version 4.2.1
  • xUnit -version 2.1.0
  • xUnit.Runner.Dnx -version 2.1.0
  • Microsoft.AspNetCore.TestHost
  • Microsoft.EntityFrameworkCore.InMemory
  • Microsoft.EntityFrameworkCore.Sqlite
  • EfCore.TestSupport

Moq is used for mocking the 3rd party objects or objects beyond the scope of unit test so that unit tests can be written for well effective smaller unit.

  1. Integration testing your asp .net core app with an in memory database
  2. Integration testing your asp .net core app dealing with anti request forgery csrf formdata and cookies 

Unit Testing

https://nance.io/leveling-up-your-dotnet-testing/

https://nance.io/leveling-up-your-dotnet-testing-transactional-integration-testing-in-asp-net-core/

http://www.stefanhendriks.com/2016/04/29/integration-testing-your-dot-net-core-app-with-an-in-memory-database/

https://github.com/aspnet/Docs/tree/master/aspnetcore/mvc/controllers/testing/sample

https://github.com/aspnet/EntityFramework.Docs/tree/master/samples/core/Miscellaneous/Testing

https://docs.microsoft.com/en-us/aspnet/core/test/?view=aspnetcore-2.1

https://stormpath.com/blog/tutorial-entity-framework-core-in-memory-database-asp-net-core

https://gunnarpeipman.com/testing/aspnet-core-ef-inmemory/

https://gunnarpeipman.com/aspnet/dependency-injection-in-asp-net-5/

https://scottsauber.com/2017/10/16/using-asp-net-core-testserver-ef-core-in-memory-db-together/

https://www.thereformedprogrammer.net/using-in-memory-databases-for-unit-testing-ef-core-applications/

https://www.meziantou.net/2017/08/21/testing-an-asp-net-core-application-using-testserver

http://www.dotnetcurry.com/aspnet-core/1420/integration-testing-aspnet-core