
The testing pyramid prioritizes unit, integration, and UI tests, with unit tests the largest and fastest, while UI tests cover the happy path and errors are tested in unit tests.
Write your first unit test using mstest, following arrange, act, and assert to test the calculator's add numbers with 10 and 20 and expect 30.
Set the same namespace for the Sparky main project and its unit tests, then create your first NUnit test using TestFixture and Test, following arrange, act, and assert.
Add a boolean odd-number checker method to the calculator class. Create two unit tests: odd input returns true, even input returns false, using NUnit or XUnit in .NET Core.
Master string assertion helpers in .NET unit testing with NUnit and XUnit. Use equality checks, containment, starts with, ends with, ignore case, and regex matches to validate output strings.
Use a global setup method with a setup attribute to initialize a shared customer object for all tests, removing duplicated code.
Explore collection helper methods in unit testing for .net core with nunit and xunit, including equality, contains, count, is ordered, and is unique.
create a grading calculator class, implement score and attendance logic, and build five unit tests (four specific cases and one multi-input case) to validate grades.
Write and run the first unit test for the fibo series in a .NET Core project, using an arrange, act, and assert pattern and assertions to verify output.
Examine a product price flow where platinum customers receive a 20% discount via get price, and validate the result with unit tests while warning against unnecessary interface mocks.
Implement log to db and log balance after withdrawal, returning booleans based on balance checks, and unit test this withdrawal and logging logic in .NET Core with NUnit and XUnit.
Explore how to configure default return values in mock setups, validate withdrawal scenarios with balances, and use range checks to simulate negative inputs in unit tests.
Convert the gradient calculator to x unit test by uncommenting the code and completing the conversion, gaining practical x unit practice. Pause the video, then continue in the next video.
convert the product unit test to xunit, remove comments, add using statements, and use equal assertions to verify the result equals 40.
Convert bank account unit tests from NUnit to XUnit in net core, using fact, theory, and inline data to verify get balance and equality assertions.
Describe a four-project .net core architecture (web project, three class libraries) with repository pattern and EF Core, including models, view models, seeding, and service-driven booking flow for unit testing.
Create a class library for unit tests targeting the bongo dot models project and install NUnit, NUnit3TestAdapter, and Microsoft.NET.Test.Sdk for the test framework. Test the date in future validation attribute by asserting that now plus 100 seconds is valid and now minus 100 seconds is invalid.
Explore how shared database state makes unit tests fail when run together, and fix it with an in-memory Entity Framework Core DbContext, test order, and database cleanup.
Develop unit tests for the room booking controller in .NET Core using NUnit and XUnit, mocking the study room booking service and verifying the index action invokes get all booking.
"Production application can break with a simple change that was unexpected to alter any other functionality" Sounds familiar right?!
Good news is, with well written unit test's this would be a thing of the past.
Automated testing has been a buzz word for a while but many times developers struggle to find a course that covers the fundamentals of unit testing while implementing what they learned in a real world project! That is the main focus of this course.
This course is all about writing effective unit tests using C# programming language and NUnit /XUnit as a unit testing framework. Along the way, we will learn the concepts related to unit testing. Today unit testing is an absolutely required skill from any professional developer. Companies expect from developers to know how to write unit tests using best practices. This course will help you setup a solid foundation with a real world example and how unit testing could be done in a .NET Core Web application with EF Core.
What is unit testing?
UNIT TESTING is a type of software testing where individual units or components of a software are tested. The purpose is to validate that each unit of the software code performs as expected.
Why learn unit testing?
Why should I learn unit testing? Why spend extra time to write code to test? Is manual testing not sufficient?
These are pretty common questions and I will answer them all but most of the times manual testing is much more time consuming and it is not as through as unit test. Unit tests take time once to write and can be executed for free every time!
As application grows, the cost of manual testing grows exponentially. And manual testing will never give 100% confidence with all the edge cases.. Automated tests help you to catch the bugs while it is in development phase, because of which they would be easier to resolve.
Will it help me with job?
Many times, skills comes with that will that skill help me achieve professionally. Unit testing is a very valuable skill with the current development cycle. It is a must have skill in most organizations for senior developers.
By end of this course you will have a solid foundation with unit testing. Along with a solid foundation we will implement what we learned in real world N-Tier web application with .NET 6 and EF Core.