
An introduction to the course and what you will learn in this course.
What is unit testing? What types of unit testing exist?
Explore how NUnit is an automated unit testing framework for dotnet versions, including legacy net framework, net core, and dotnet seven and eight, with class libraries from NuGet and runners.
Create a dedicated test project in Visual Studio and add a calculator tests class to test the add method using arrange, act, and assert.
Explore clear test naming and exception verification for a word processor print method, using NUnit to assert no exception and to assert the not implemented exception.
Show how to use the StringAssert class to test the make full name function, prefixing with Mr. or Ms. by gender, using startswith and endswith.
Apply the setup attribute to run before every test method and initialize values. Learn that one time setup runs once per test class and tear down runs after tests.
Group multiple asserts with Assert.Multiple by passing an action that contains the asserts, so execution continues through the block and ends only when the group fails, as a single unit.
Learn to unit test an ASP.NET MVC action using Moq and NUnit by creating a test project, mocking dependencies, and asserting that the login controller index returns the login view.
What is Test-Driven Development (TDD) and what are its benefits and drawbacks?
Demonstrates test driven development by creating skeleton methods returning zero, writing unit tests for subtract and multiply, and running tests to reveal red failures before implementing code to pass.
We don't always get to write unit tests with NUnit for our own code. Often we find a code that was written long ago by someone else. You may ask, why would you write unit tests for an old code?
The answer is that we don't write unit tests to see if a piece of code or a function works as expected. We also write unit tests to make sure our new changes have not broken the old or existing code. That is why it is highly recommended that to write unit tests for legacy code before you begin to modify it.
In this lecture you will learn about a technique called Sprout Method. Using this technique you can write a unit test for a piece of code tha you add to a legacy code to make sure everything works as expected.
If you're a .NET developer looking to improve the quality and reliability of your code, then this online course on Unit Testing in .NET and C# with NUnit and MOQ is perfect for you!
In this comprehensive course, you'll learn everything you need about NUnit and its usage in the latest version of .NET.
With C#, including how to write practical unit tests using the NUnit and MOQ frameworks. You'll also learn about Test Driven Development (TDD) and how to apply it to your projects.
But that's not all—we'll also cover unit testing legacy code, a crucial skill for any developer who wants to maintain and improve existing codebases. To ensure you're fully prepared for any job interviews, we've included interview questions and answers related to unit testing and NUnit.
Our expert instructor will guide you through the course, providing clear explanations and hands-on examples to help you master the material. By the end of the period, you'll deeply understand NUnit and unit testing and the skills and knowledge needed to apply these techniques to your projects confidently.
This course is perfect for anyone who wants to take their .NET development skills to the next level. Whether you're a beginner looking to learn the basics of unit testing or an experienced developer looking to improve your skills, this course has everything you need to succeed.
So don't wait - enroll now and start mastering unit testing with NUnit today!