Environment Setup
Prepare the environment for hands-on learning by running code directly. Each step takes just a few minutes.
Required Prerequisites
Section titled “Required Prerequisites”1. .NET 10.0 SDK
Section titled “1. .NET 10.0 SDK”The .NET SDK is required for building and running all projects.
# Version checkdotnet --version# Example output: 10.0.100
# Install (Windows)winget install Microsoft.DotNet.SDK.10
# Install (macOS)brew install --cask dotnet-sdk
# Install (Linux - Ubuntu)sudo apt-get update && sudo apt-get install -y dotnet-sdk-10.02. IDE Setup
Section titled “2. IDE Setup”VS Code + C# Dev Kit
Section titled “VS Code + C# Dev Kit”- Install the C# Dev Kit extension
Project Setup
Section titled “Project Setup”Clone Source Code
Section titled “Clone Source Code”# Clone the Functorium projectgit clone https://github.com/hhko/Functorium.gitcd functoriumVerify Build
Section titled “Verify Build”# Build the entire solutiondotnet build Functorium.slnx
# Run all testsdotnet test --solution Functorium.slnxRun Individual Projects
Section titled “Run Individual Projects”# Build the entire tutorialdotnet build specification-pattern.slnx
# Test the entire tutorialdotnet test --solution specification-pattern.slnxDefault Using Statements
Section titled “Default Using Statements”Default using statements used in projects:
using Functorium.Domains.Specifications;When using Expression Specification:
using System.Linq.Expressions;using Functorium.Domains.Specifications;How to Run Each Project
Section titled “How to Run Each Project”Running Tests
Section titled “Running Tests”# Test the entire tutorialdotnet test --solution specification-pattern.slnx
# Run specific tests onlydotnet test --solution specification-pattern.slnx --filter "IsSatisfiedBy_ReturnsTrue_WhenProductIsActive"Full Solution Test
Section titled “Full Solution Test”# From the solution rootdotnet test --solution specification-pattern.slnxProject Structure
Section titled “Project Structure”Each tutorial project has the following structure:
01-First-Specification/├── FirstSpecification/ # Main project│ ├── FirstSpecification.csproj # Project file│ └── Specifications/ # Specification classes│ └── ActiveProductSpec.cs│└── FirstSpecification.Tests.Unit/ # Test project ├── FirstSpecification.Tests.Unit.csproj ├── xunit.runner.json └── ActiveProductSpecTests.csTroubleshooting
Section titled “Troubleshooting”.NET SDK Not Recognized
Section titled “.NET SDK Not Recognized”# Check PATH environment variableecho $PATH
# For Windows, add the following path to system environment variables# C:\Program Files\dotnetIntelliSense Not Working in IDE
Section titled “IntelliSense Not Working in IDE”- Restart the IDE
- Run
dotnet restore - Delete the
.vsor.vscodefolder and restart
Q1: Is .NET 10.0 SDK mandatory?
Section titled “Q1: Is .NET 10.0 SDK mandatory?”A: Yes. All projects in this tutorial target .NET 10.0. Some Functorium library APIs require .NET 10.0 or later, so the build may fail on earlier versions.
Q2: Can individual projects be built/tested independently?
Section titled “Q2: Can individual projects be built/tested independently?”A: Yes, running dotnet test from each chapter’s project folder tests that project independently. The full solution build is performed with dotnet build Functorium.slnx.
Q3: Which IDE should I use?
Section titled “Q3: Which IDE should I use?”A: Use whichever is comfortable among VS Code + C# Dev Kit, JetBrains Rider, or Visual Studio 2022. Any IDE will work as long as the C# development environment is set up and .NET 10.0 SDK is installed.
Next Steps
Section titled “Next Steps”Environment setup is complete. Now let’s look at the big picture of what problems the Specification pattern solves.