C# Testing

Automate C# strategy testing in NinjaTrader 8 with NUnit or XUnit.

Updated Jun 3, 2026
One-click install
npx skills add https://github.com/antigravityos187-sketch/universal-or-strategy --skill c-testing-antigravityos187-sketch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: C# Testing
Source: https://github.com/antigravityos187-sketch/universal-or-strategy/tree/main/.agent/skills/csharp-testing
Command: npx skills add https://github.com/antigravityos187-sketch/universal-or-strategy --skill c-testing-antigravityos187-sketch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires nunit, moq, benchmarkdotnet, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a structured approach to testing the NinjaTrader 8 strategy by automating unit tests, integration tests, and performance benchmarking, ensuring code quality and reliability.

Core Features & Use Cases

  • Automated Testing: Execute tests for unit, integration, and performance, reducing manual effort.
  • Compatibility: Ensures tests are compatible with NinjaTrader 8's .NET Framework 4.8.
  • Patterns: Implements state machine verification, lock-free audit, zero-allocation checks, and IPC round-trip tests.
  • Use Case: Refactoring a complex method in the V12 Universal OR Strategy, this Skill can help ensure no logic regression after changes.

Quick Start

Run unit tests for the strategy using dotnet test.

Frequently Asked Questions about C# Testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate C# testing for NinjaTrader 8 strategies?

You can automate C# testing for NinjaTrader 8 strategies by running NUnit or XUnit tests via the dotnet test command. This verifies state machine transitions and concurrency safety within the .NET Framework 4.8 environment.

What's the best way to benchmark NinjaTrader 8 strategy performance in C#?

Benchmark NinjaTrader 8 strategy performance using BenchmarkDotNet to perform zero-allocation checks and measure allocation efficiency. This ensures your C# 8.0 strategy code runs optimally under .NET Framework 4.8.

Can I use NUnit and Moq for mocking in NinjaTrader 8 C# strategies?

Yes, you can use NUnit and Moq for mocking dependencies in NinjaTrader 8 C# strategies. This combination isolates components and verifies state machine transitions without external interference.

Does this C# testing approach support .NET Framework 4.8 and C# 8.0?

Yes, this C# testing approach explicitly supports .NET Framework 4.8 and C# 8.0. It ensures compatibility with NinjaTrader 8's technical constraints while validating lock-free audit and IPC round-trip tests.

Why do I need to verify state machine transitions in my NinjaTrader 8 strategy?

Verifying state machine transitions in your NinjaTrader 8 strategy ensures no logic regression after code changes. This automated testing pattern validates complex method refactoring and maintains overall code reliability.

How do I run unit tests for a C# strategy to prevent logic regressions?

Run unit tests for your C# strategy using the dotnet test command. This automates verification of state machine transitions and concurrency safety, preventing logic regressions during refactoring.