audit-infra
Infrastructure-first security audit — secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Run .NET/C# tests for Unity projects and backend services
> /plugin marketplace add solanabr/solana-ai-kit > /plugin install solana-ai-kit@stbr
How it fires
How this command gets triggered: by you, by Claude, or both.
/test-dotnetContext preview
What this command does when you run it.
Run .NET/C# tests for Unity projects and backend services
description: "Run .NET/C# tests for Unity projects and backend services"
You are running .NET/C# tests. This command covers Unity Test Framework (Edit Mode and Play Mode) and standard .NET testing.
---
When developing with TDD, follow these phases strictly:
1. Create test file in appropriate location (`Tests/EditMode/` or `Tests/PlayMode/`) 2. Write minimal test that fails for the right reason 3. Run test to confirm it fails 4. **Do NOT write production code yet**
[Test]
public void Calculate_WithValidInput_ReturnsExpected()
{
var sut = new Calculator(); // Class doesn't exist yet
var actual = sut.Calculate(10, 2);
Assert.That(actual, Is.EqualTo(12));
}1. Write minimal production code to pass the test 2. **Only write enough code to pass** - no more 3. Run test to confirm it passes 4. Commit if green
public class Calculator
{
public int Calculate(int a, int b) => a + b; // Minimal implementation
}1. Improve code structure without changing behavior 2. Run tests after each refactoring step 3. Keep tests green throughout 4. Apply SOLID principles, remove duplication
1. Return to Phase 1 for next test case 2. Build up functionality incrementally 3. Each cycle: RED → GREEN → REFACTOR
1. After unit tests pass, run integration tests 2. Test component interactions 3. For Unity: run Play Mode tests
1. Review test coverage 2. Check for missing edge cases 3. Ensure tests are maintainable 4. Remove any redundant tests
---
Operate in fast, surgical development cycles with minimal token usage.
1. **Understand the Request**: Analyze minimum code required 2. **Make the Change**: Implement surgical edit 3. **Build**: `dotnet build --no-restore --nologo --verbosity minimal` 4. **If Build Fails**: Retry once if obvious fix, then **STOP and ask** 5. **Run Tests**: `dotnet test --no-build --nologo --verbosity minimal` 6. **If Tests Fail**: Extract failures with `rg`, fix if obvious, else **STOP and ask**
If build or test fails twice on the same issue: 1. **STOP** immediately 2. Present the error output 3. Show the code change made 4. Ask for user guidance
---
echo "🔍 Detecting .NET project type..."
if [ -f "ProjectSettings/ProjectVersion.txt" ]; then
echo "🎮 Unity project detected"
PROJECT_TYPE="unity"
cat ProjectSettings/ProjectVersion.txt
elif [ -f "*.sln" ] || [ -f "*.csproj" ]; then
echo "📦 .NET solution/project detected"
PROJECT_TYPE="dotnet"
else
echo "❓ No .NET project found"
exit 1
fi---
echo "🧪 Running Unity tests..."
# Run all tests (Edit Mode + Play Mode)
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testResults TestResults.xml \
-logFile test.log
# Check results
if [ $? -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "❌ Some tests failed"
# Parse results
grep -E "Failed|Error" test.log | head -20
fiecho "📝 Running Edit Mode tests..."
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testPlatform EditMode \
-testResults EditModeResults.xml \
-logFile editmode.log
if [ $? -eq 0 ]; then
echo "✅ Edit Mode tests passed!"
else
echo "❌ Edit Mode tests failed"
grep -E "Failed|Error" editmode.log | head -20
fiecho "🎮 Running Play Mode tests..."
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testPlatform PlayMode \
-testResults PlayModeResults.xml \
-logFile playmode.log
if [ $? -eq 0 ]; then
echo "✅ Play Mode tests passed!"
else
echo "❌ Play Mode tests failed"
grep -E "Failed|Error" playmode.log | head -20
fi# Run tests from specific assembly
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testPlatform EditMode \
-assemblyNames "MyGame.Tests" \
-testResults Results.xml \
-logFile test.log# Run specific test class
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testFilter "WalletServiceTest" \
-testResults Results.xml \
-logFile test.log
# Run specific test method
unity-editor -runTests -batchmode -nographics \
-projectPath . \
-testFilter "WalletServiceTest.Connect_WithValidCredentials_ReturnsTrue" \
-testResults Results.xml \
-logFile test.logecho "📊 Parsing test results..."
if [ -f "TestResults.xml" ]; then
# Count results
TOTAL=$(grep -c "test-case" TestResults.xml || echo "0")
PASSED=$(grep -c 'result="Passed"' TestResults.xml || echo "0")
FAILED=$(grep -c 'result="Failed"' TestResults.xml || echo "0")
echo "Total: $TOTAL | Passed: $PASSED | Failed: $FAILED"
# Show failed tests
if [ "$FAILED" -gt 0 ]; then
echo ""
echo "❌ Failed tests:"
grep -B1 'result="Failed"' TestResults.xml | grep "name=" | head -10
fi
fi---
echo "🧪 Running .NET tests..."
# Restore and build first
dotnet restore
dotnet build --no-restore --configuration Release
# Run tests
dotnet test --no-build --configuration Release \
--logger "console;verbosity=normal" \
--results-directory TestResults
if [ $? -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "❌ Some tests failed"
fiProduction-ready Claude Code configuration for full-stack Solana development. Combines best practices from multiple sources into an agent-optimized, token-efficient config you can install and adapt to your specific project.
Repo: solanabr/solana-ai-kit
Infrastructure-first security audit — secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Benchmark CU usage and compare against baseline for regression detection