You can make business logic tests into real unit tests by mocking out the dependencies.
- [Instructor] Now that we have some tests,…let's make the business logic test…of move salesperson to group better…by mocking out some of the dependencies.…First, we'll add some mocks of our own,…and then we'll use the mocking framework, Moq, M-O-Q.…In the HPlusSports.Core.Test project,…we can add a folder for mocks.…Right-click, add, folder,…Mocks, and then we can right-click Mocks,…add class,…SalesPersonRepositoryMock,…and add class,…SalesGroupRepositoryMock.…
Let's start in SalesGroupRepositoryMock.…We'll add the interface of the repository we're mocking.…And Ctrl + Period to add models…DAL,…and to implement the interface.…Now we'll do the same thing for the…SalesPersonRepositoryMock.…
Ctrl + Shift + S to save both files.…We'll come back to the implementations…of the mock momentarily.…For now, we'll change the test to use these mocks.…Open up the tests file.…We don't need the context anymore…since we can test against mock repositories…instead of the real ones.…So let's remove that code now.…We can also remove the code that creates…
- What is good application architecture?
- Real-world software and the SDLC
- Common knowledge and maintenance
- Choosing an architecture
- Design patterns with EF
- Debugging and error handling
- Architecture for the web with ASP.NET
- Designing for unit testing
- Strategies for dealing with common performance issues
Skill Level Advanced
Deploying ASP.NET Core Applicationswith Nate Barbettini57m 57s Intermediate
Microsoft SQL Server 2016 Essential Trainingwith Martin Guidry3h 18m Intermediate
1. Why Do All of This Architecture?
2. Design Patterns with EF
3. Error Handling
4. Architecture for the Web with ASP.NET
5. Designing for Unit Testing
6. Entity Framework Mistakes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.