Skip to content

unrealguest/MoqDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is a simple example that shows the basics of mocking using the Moq framework. Feel free to fork the project and use it as a playground to develop your own ideas and tests using NHibernate and Moq!

What's contained in this project

The project reads the Books.json file and loads the records contained within into a small self-contained sqlite database. The models, mappings and the database accesses are built using NHibernate / FluentNHibernate. Feel free to check those parts as well as they could be useful for you in the future projects.

How to run the project

This project is a .Net Core 3.1 project so you can either import it into Visual Studio / Visual Studio Code and run it as you would normally, or you can use the terminal as well. You will of course need the .Net Core 3.1 runtime on the machine you are trying to run the project. (https://dotnet.microsoft.com/download/dotnet/3.1)

  1. Navigate into the MoqDemo project folder and use the command dotnet run to run the application. This will create the sqlite database, fill it with the data provided by the Books.json file and write the books and authors into the console output.

  2. Then, you can run the unit tests either from the root folder or from the MoqDemoTest folder using the dotnet test command. This will run the unit tests and print the result into the console output.

Want more?

If you want to read more about the possibilities of Moq and / or NHibernate, see the following links:

About

Demo Project for using Moq as a mocking framework in a .NET Core environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages