Back to Browse

.Net Core Unit Testing using XUnit and Moq

76.9K views
Feb 4, 2018
25:21

In this video, I will be doing unit testing for the business layer for an ASP.Net Core Web API application. And I will be using XUnit for the unit testing framework and Moq for mocking framework. XUnit is an open-source unit testing framework that supports both traditional .Net Framework as well as .Net Core Framework. Moq is a mocking framework, which helps mock an interface or abstract class. This helps not worrying about the interfaces that are dependencies of a class. But just focusing on the core logic of the class under test. Unit testing is extremely important for agile development. From my personal experience, it is much easier to do changes in a rapid development environment, if you have better coverage with unit testing. I personally prefer to have good enough tests to give me confidence that I can make changes without worrying about defects. Unit testing adds cost to the overall projects, so you have to make the right balance between your test coverage vs rework cost. A couple of other popular unit testing frameworks worth mentioning: NUnit, MS Test, MachineSpecs A popular mocking framework: FakeItEasy Link to my blog post where I cover in-depth on XUnit and Moq for testing: http://bit.ly/2pGxj22

Download

0 formats

No download links available.

.Net Core Unit Testing using XUnit and Moq | NatokHD