Skip to content

ksmslearnings/MvcCoreUnitTesting

Repository files navigation

MvcCoreUnitTesting

Asp.Net Core MVC Web Application Unit testing with MStestV2 - FluentAssertions - MOQ

  • This Solution Explains how to handle Unit Test Automation using MSTESTV2 Framework - MOQ - FluentAssertions and FluentAssertions.AspNetCore.MVC.

  • Details of Unit Testing and this solution is available at https://www.technologysplash.com/unittest-dotnetcore-mvc-mstestv2-moq-fluentassertions/.

  • MSTestV2 is latest cross platform and open sourced test Framework from Microsoft and uses .Net Core standard. It can be run on any platform including Windows/Linux/Mac.

  • MOQ is mocking framework used for isolating system udner test. Please see details my site www.technologysplash.com for more details. it is available as Nuget package.

  • FluentAssertions and FluentAssertions.AspNetCore.MVC are Nuget packages available for for Unit Tests and provide human readable assertions techniques making unit tests easier to understand and also help with better documentation.

  • Main Project is Asp.Net Core MVC web application with pretty standard MVC pages. I am using very simple eCommerse based site with Product List, Add To Cart and Checkout pages for demonstration.

  • Some compplexity is added in some of the Action Methods to show how to handle Mocking of standard web features like HttpContext, ControllerContext, HttpRequest/Response, Session, Cookies, http Cache etc. Article https://www.technologysplash.com/unittest-dotnetcore-mvc-mstestv2-moq-fluentassertions/ explains most mocking scenario in details.

  • You should be able to clone this repo and directly able to build and run it.

In case you see any issues, do get back to me or connect with me via email/my blog site/linkedIn. I will make necessary changes as soon as possible

About

Asp.Net Core MVC Web Application Unit testing with MStestV2 - FluentAssertions - MOQ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published