---
title: "Testing Data Models"
canonical: https://www.quantconnect.com/docs/v2/lean-engine/contributions/datasets/testing-data-models
markdown: https://www.quantconnect.com/docs/v2/lean-engine/contributions/datasets/testing-data-models.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/06%20LEAN%20Engine/02%20Contributions/01%20Datasets/05%20Testing%20Data%20Models
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Testing Data Models

[Documentation](https://www.quantconnect.com/docs/v2.md) > [LEAN Engine](https://www.quantconnect.com/docs/v2/lean-engine.md) > Contributions > Datasets > Testing Data Models

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

The implementation of your Data Source must be thoroughly tested to be listed on the [Dataset Market](https://www.quantconnect.com/datasets).

## Run Demonstration Algorithms

Follow these steps to test if your demonstration algorithm will run in production with the processed data:

1. Open the `Lean.DataSource.<vendorNameDatasetName> / QuantConnect.DataSource.csproj` file in Visual Studio.
2. In the top menu bar of Visual Studio, click **Build > Build Solution**.
   The Output panel displays the build status of the project.
3. Close Visual Studio.
4. If you have a local copy of LEAN, pull the latest changes.
   ```
   $ git pull upstream master
   ```
5. If you don't have a local copy of LEAN, [fork the LEAN repository](https://github.com/QuantConnect/Lean/fork) and then [clone it](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
   ```
   $ git clone https://github.com/<username>/Lean.git
   ```
6. Copy the contents of the `Lean.DataSource.<vendorNameDatasetName> / output` directory and paste them into the `Lean / Data` directory.
7. Open the `Lean / QuantConnect.Lean.sln` file in Visual Studio.
8. In the Solution Explorer panel of Visual Studio, right-click `QuantConnect.Algorithm.CSharp` and then click **Add > Existing Item…**.
9. In the Add Existing Item window, click the `Lean.DataSource.<vendorNameDatasetName> / <vendorNameDatasetName>Algorithm.cs` file and then click **Add**.
10. In the Solution Explorer panel, right-click `QuantConnect.Algorithm.CSharp` and then click **Add > Project Reference...**.
11. In the Reference Manager window, click **Browse…**.
12. In the Select the files to reference… window, click the `Lean.DataSource.<vendorNameDatasetName> / bin / Debug / net9.0 / QuantConnect.DataSource.<vendorNameDatasetName>.dll` file and then click **Add**.
   The Reference Manager window displays the `QuantConnect.DataSource.<vendorNameDatasetName>.dll` file with the check box beside it enabled.
13. Click **OK**.
   The Solution Explorer panel adds the `QuantConnect.DataSource.<vendorNameDatasetName>.dll` file under **QuantConnect.Algorithm.CSharp > Dependencies > Assemblies**.
14. In the `Lean / Algorithm.CSharp / <vendorNameDatasetName>Algorithm.cs` file, [write an algorithm](https://www.quantconnect.com/docs/v2/writing-algorithms.md) that uses your new dataset.
15. In the Solution Explorer panel, click `QuantConnect.Lean.Launcher > config.json`.
16. In the `config.json` file, set the following keys:
   ```
   "algorithm-type-name": "<vendorNameDatasetName>Algorithm",
   "algorithm-language": "CSharp",
   "algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
   ```
17. Press **Ctrl+F5** to backtest your demonstration algorithm.
18. Copy the `Lean.DataSource.<vendorNameDatasetName> / <vendorNameDatasetName>Algorithm.py` file and paste it in the `Lean / Algorithm.Python` directory.
19. In the `Lean / Algorithm.Python / <vendorNameDatasetName>Algorithm.py` file, [write an algorithm](https://www.quantconnect.com/docs/v2/writing-algorithms.md) that uses your new dataset.
20. In the Solution Explorer panel, click `QuantConnect.Lean.Launcher > config.json`.
21. In the `config.json` file, set the following keys:
   ```
   "algorithm-type-name": "<vendorNameDatasetName>Algorithm",
   "algorithm-language": "Python",
   "algorithm-location": "../../../Algorithm.Python/<vendorNameDatasetName>Algorithm.py",
   ```
22. Press **Ctrl+F5** to backtest your demonstration algorithm.
   > Important: Your backtests must run without error. If your backtests produce errors, correct them and then run the backtest again.
23. Copy the `Lean / Algorithm.CSharp / <vendorNameDatasetName>Algorithm.cs` file to `Lean.DataSource.<vendorNameDatasetName> / <vendorNameDatasetName>Algorithm.cs`.
24. Copy the `Lean / Algorithm.Python / <vendorNameDatasetName>Algorithm.py` file to `Lean.DataSource.<vendorNameDatasetName> / <vendorNameDatasetName>Algorithm.py`.

## Run Unit Tests

You must [run your demonstration algorithms](https://www.quantconnect.com/docs/v2/lean-engine/contributions/datasets/testing-data-models.md#02-Run-Demonstration-Algorithms) without error before you set up unit tests.

In the `Lean.DataSource.<vendorNameDatasetName> / <vendorNameDatasetName>Tests.cs` file, define the `CreateNewInstance` method to return an instance of your `DataSource` class and then execute the following commands to run the unit tests:

```
$ dotnet build tests/Tests.csproj
$ dotnet test tests/bin/Debug/net9.0/Tests.dll
```
