< Summary

Class:AgentTestBase
Assembly:bamlab.test
File(s):/github/workspace/Assets/Tests/AgentTestBase.cs
Covered lines:0
Uncovered lines:23
Coverable lines:23
Total lines:41
Line coverage:0% (0 of 23)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:4
Method coverage:0% (0 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Setup()0%2100%
Teardown()0%6200%
CreateTestInterceptor(...)0%2100%
CreateTestThreat(...)0%2100%

File(s)

/github/workspace/Assets/Tests/AgentTestBase.cs

#LineLine coverage
 1using System;
 2using System.Reflection;
 3using NUnit.Framework;
 4using UnityEngine;
 5
 6public abstract class AgentTestBase : TestBase {
 7  protected SimManager simManager;
 8
 9  [SetUp]
 010  public virtual void Setup() {
 11    // Initialize SimManager
 012    var simManagerGameObject = new GameObject("SimManager");
 013    simManager = simManagerGameObject.AddComponent<SimManager>();
 014    simManager.simulationConfig = new SimulationConfig();  // Set up a basic config if needed
 15
 016    SimManager.Instance = simManager;
 017  }
 18
 19  [TearDown]
 020  public virtual void Teardown() {
 21    // Clean up SimManager
 022    if (simManager != null) {
 023      GameObject.DestroyImmediate(simManager.gameObject);
 024    }
 025  }
 26
 027  protected Interceptor CreateTestInterceptor(DynamicAgentConfig config) {
 028    Interceptor interceptor =
 29        InvokePrivateMethod<Interceptor>(simManager, "CreateInterceptor", config);
 030    InvokePrivateMethod(interceptor, "Start");
 031    InvokePrivateMethod(interceptor.gameObject.GetComponent<Sensor>(), "Start");
 032    return interceptor;
 033  }
 34
 035  protected Threat CreateTestThreat(DynamicAgentConfig config) {
 036    Threat threat = InvokePrivateMethod<Threat>(simManager, "CreateThreat", config);
 037    InvokePrivateMethod(threat, "Start");
 038    InvokePrivateMethod(threat.gameObject.GetComponent<Sensor>(), "Start");
 039    return threat;
 040  }
 41}