Unit Testing EF Data With Core 2.0

I’ve discussed using the in-memory database object for Entity Framework in the blog post titled: Dot Net Core In Memory Unit Testing Using xUnit. That was for .Net Core 1.1.  Now I’m going to show a larger example of the in-memory database object for .Net Core 2.0.  There is only one minor difference in the … Read moreUnit Testing EF Data With Core 2.0

Unit Testing EF Data With Moq

Introduction I’ve discussed using the in-memory Entity Framework unit tests in a previous post (here).  In this post, I’m going to demonstrate a simple way to use Moq to unit test a method that uses Entity Framework Core. Setup For this sample, I used the POCOs, context and config files from this project (here).  You … Read moreUnit Testing EF Data With Moq

XML Serialization

Summary In this post I’m going to demonstrate the proper way to serialize XML and setup unit tests using xUnit and .Net Core.  I will also be using Visual Studio 2017. Generating XML JSON is rapidly taking over as the data encoding standard of choice.  Unfortunately, government agencies are decades behind the technology curve and … Read moreXML Serialization

Mocking Your File System

Introduction In this post, I’m going to talk about basic dependency injection and mocking a method that is used to access hardware.  The method I’ll be mocking is the System.IO.Directory.Exists(). Mocking Methods One of the biggest headaches with unit testing is that you have to make sure you mock any objects that your method under … Read moreMocking Your File System

.Net MVC Project with AutoFac, SQL and Redis Cache

Summary In this blog post I’m going to demonstrate a simple .Net MVC project that uses MS SQL server to access data.  Then I’m going to show how to use Redis caching to cache your results to reduce the amount of traffic hitting your database.  Finally, I’m going to show how to use the AutoFac … Read more.Net MVC Project with AutoFac, SQL and Redis Cache

DotNet Core vs. NHibernate vs. Dapper Smackdown!

The Contenders Dapper Dapper is a hybrid ORM.  This is a great ORM for those who have a lot of ADO legacy code to convert.  Dapper uses SQL queries and parameters can be used just like ADO, but the parameters to a query can be simplified into POCOs.  Select queries in Dapper can also be … Read moreDotNet Core vs. NHibernate vs. Dapper Smackdown!