Mocking in C# Unit Tests - How To Test Data Access Code and More
Unit tests are great, but how do you test your data access? You sure don't want to actually delete records when you are testing the delete method, yet you definitely want to be sure the method is configured properly. This is the type of problem that stops a lot of developers from creating unit tests. In this video, I am going to show you how to overcome these obstacles in order to write tests that handle working with external dependencies like databases.
Full courses: https://www.iamtimcorey.com/
Source Code: https://leadmagnets.app/?Resource=MockingInUnitTests
Patreon: https://patreon.com/IAmTimCorey
Newsletter signup: https://signup.iamtimcorey.com/
Sponsors:
Tuhafeni Angula (Patreon Subscriber)
0:00 - Intro
1:05 - Getting started: demo application code and setup
10:20 - Problems with testing methods that manipulates with external stuff (database edits, e-mail senders etc)
12:39 - Mocking explained
15:44 - Writing tests with mocking
18:05 - Adding references for testing with MOCK
20:51 - Using statement
22:12 - AutoMock.GetLoose() vs AutoMock.GetStrict();
23:30 - Using AutoMock: Writing the Unit Test with mocking
35:06 - Refactoring method that's under a UnitTest
36:03 - Checking data: comparing two objects
40:19 - Testing method that returns void
48:16 - Testing SQl call modification
52:47 - Recap
53:30 - Advice for beginners
55:15 - What not to test and why
58:24 - Summary
59:27 - Learning steps
1:01:42 - Concluding remarks
Видео Mocking in C# Unit Tests - How To Test Data Access Code and More канала IAmTimCorey
Full courses: https://www.iamtimcorey.com/
Source Code: https://leadmagnets.app/?Resource=MockingInUnitTests
Patreon: https://patreon.com/IAmTimCorey
Newsletter signup: https://signup.iamtimcorey.com/
Sponsors:
Tuhafeni Angula (Patreon Subscriber)
0:00 - Intro
1:05 - Getting started: demo application code and setup
10:20 - Problems with testing methods that manipulates with external stuff (database edits, e-mail senders etc)
12:39 - Mocking explained
15:44 - Writing tests with mocking
18:05 - Adding references for testing with MOCK
20:51 - Using statement
22:12 - AutoMock.GetLoose() vs AutoMock.GetStrict();
23:30 - Using AutoMock: Writing the Unit Test with mocking
35:06 - Refactoring method that's under a UnitTest
36:03 - Checking data: comparing two objects
40:19 - Testing method that returns void
48:16 - Testing SQl call modification
52:47 - Recap
53:30 - Advice for beginners
55:15 - What not to test and why
58:24 - Summary
59:27 - Learning steps
1:01:42 - Concluding remarks
Видео Mocking in C# Unit Tests - How To Test Data Access Code and More канала IAmTimCorey
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Intro to Unit Testing in C# using XUnitUnit Tests and Test Doubles like Mocks, Stubs & FakesRefactoring in C# - Improving an Existing ApplicationC# Async / Await - Make your app more responsive and faster with asynchronous programmingEntity Framework Best Practices - Should EFCore Be Your Data Access of Choice?Design Patterns: Dependency Inversion Principle Explained Practically in C# (The D in SOLID)C# Dependency Injection with AutofacGetting started with Mocking using Moq in .NET (Core, Framework, Standard)Unit Testing: MOQ FrameworkDesign Patterns: Interface Segregation Principle Explained Practically in C# (The I in SOLID)How to Use MOQ With C# For Test Driven DevelopmentWhat is Mock testing ( MOQ) ?The refactoring test (1) - Dependency Inversion & Unit tests | Cracking the .NET interviewHandling Exceptions in C# - When to catch them, where to catch them, and how to catch themFluent Validation in C# - The Powerful Yet Easy Data Validation ToolUnit Testing C# Code - Tutorial for BeginnersTop 10 C# Best Practices (plus bonuses)Date and Time in C# 10 and .NET 6 In 10 Minutes or LessC# Generics - What they are, why they are useful, and how to create them