From the course: Practical Application Architecture with Entity Framework Core
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
InMemory database provider - Entity Framework Tutorial
From the course: Practical Application Architecture with Entity Framework Core
InMemory database provider
- [Instructor] The in-memory database provider is what makes testing data access code and data logic easy in Entity Framework. It isn't a real relational database, so it doesn't enforce foreign keys or create default values like a real database. This means the database level errors can still slip by in unit testing with the in-memory database, but it is still useful for a lot of different types of tests. Let's see what it looks like by creating some simple tests in our demo project. First, let's create a test against moveSalespersonToGroup since we don't have a front end for that method yet. Right-click the solution an select Add > New Project. Ensure .NET Core is selected. Then select Unit Test Project. This will create a MS test or Visual Studio test project. Visual Studio also integrates with xUnit tests, which have some slightly different paradigms but generally do the same thing. We're going to demo with the MS test project. Name the project HPlusSports.Core.Test. When the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.