This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using DTS.DASLib.Service.StateMachine;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StateMachine.Tests
{
[TestFixture]
public class ConfigureShould
{
[Test]
public void StateSelector_Should_ReturnConfigureStart()
{
//Arrange
var sut = new Configure();
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.ConfigureStart));
}
}
}

View File

@@ -0,0 +1,89 @@
using DTS.DASLib.Service.StateMachine;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StateMachine.Tests
{
[TestFixture]
public class DiagnoseShould
{
[Test]
public void State_ShouldBeRealtime()
{
//Arrange
var sut = new Realtime();
//Act & Assert
Assert.That(State.Realtime, Is.EqualTo(sut.State));
}
[Test]
public void StateSelector_ShouldReturnRealtime_WhenRequireAllUnitsPassDiagnosticIsFalse()
{
//Arrange
var sut = new Diagnose();
var status = sut.Status;
status.DiagnoseParams.ProceedToRealtimeWhenDone = true;
status.DiagnoseParams.RequireAllUnitsPassDiagnostic = false;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.RealtimeStart));
}
[Test]
public void StateSelector_ShouldReturnRealtime_WhenAllUnitsPassedDiagnostic()
{
//Arrange
var sut = new Diagnose();
var status = sut.Status;
status.DiagnoseParams.ProceedToRealtimeWhenDone = true;
status.DiagnoseParams.AllUnitsPassedDiagnostic = true;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.RealtimeStart));
}
[Test]
public void StateSelector_ShouldReturnDiagnose_ProceedToRealtimeWhenDoneIsFalse()
{
//Arrange
var sut = new Diagnose();
var status = sut.Status;
status.DiagnoseParams.ProceedToRealtimeWhenDone = false;
status.DiagnoseParams.AllUnitsPassedDiagnostic = true;
status.DiagnoseParams.RequireAllUnitsPassDiagnostic = false;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.Diagnose));
}
[Test]
public void StateSelector_ShouldReturnDiagnose_WhenAllUnitsPassedDiagnosticIsFalseAndRequireAllUnitsPassDiagnostic()
{
//Arrange
var sut = new Diagnose();
var status = sut.Status;
status.DiagnoseParams.ProceedToRealtimeWhenDone = true;
status.DiagnoseParams.RequireAllUnitsPassDiagnostic = true;
status.DiagnoseParams.AllUnitsPassedDiagnostic = false;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.Diagnose));
}
}
}

View File

@@ -0,0 +1,134 @@
using DTS.DASLib.Service.StateMachine;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StateMachine.Tests
{
[TestFixture]
class HardwareDiscoveryStartShould
{
[Test]
public void State_ShouldBeHardwareDiscoveryStart()
{
//Arrange
var sut = new HardwareDiscoveryStart();
//Act & Assert
Assert.That(State.HardwareDiscoveryStart, Is.EqualTo(sut.State));
}
[Test]
public void StateSelector_Should_ReturnConfigure()
{
//Arrange
var sut = new HardwareDiscoveryStart();
var status = sut.Status;
status.HardwareDiscoveryParams.ProceedWhenDone = true;
status.HardwareDiscoveryStatusInfo.AllDASFound = true;
status.HardwareDiscoveryParams.RequireAllDASFound = true;
//Act
var dasState = sut.StateSelector();
//Assert
Assert.That(dasState.State, Is.EqualTo(State.Configure));
//Arrange
status.HardwareDiscoveryParams.ProceedWhenDone = true;
status.HardwareDiscoveryStatusInfo.AllDASFound = true;
status.HardwareDiscoveryParams.RequireAllDASFound = false;
//Act
dasState = sut.StateSelector();
//Assert
Assert.That(dasState.State, Is.EqualTo(State.Configure));
//Arrange
status.HardwareDiscoveryParams.ProceedWhenDone = true;
status.HardwareDiscoveryStatusInfo.AllDASFound = false;
status.HardwareDiscoveryParams.RequireAllDASFound = false;
//Act
dasState = sut.StateSelector();
//Assert
Assert.That(dasState.State, Is.EqualTo(State.Configure));
}
[Test]
public void StateSelector_Should_ReturnDownload()
{
//Arrange
var sut = new HardwareDiscoveryStart();
var status = sut.Status;
status.HardwareDiscoveryParams.ProceedWhenDone = true;
status.HardwareDiscoveryStatusInfo.AllDASFound = true;
status.HardwareDiscoveryParams.RequireAllDASFound = true;
status.HardwareDiscoveryParams.GoToDownload = true;
//Act
var dasState = sut.StateSelector();
//Assert
Assert.That(dasState.State, Is.EqualTo(State.Download));
}
[Test]
public void StateSelector_Should_ReturnArm()
{
//Arrange
var sut = new HardwareDiscoveryStart();
var status = sut.Status;
status.HardwareDiscoveryParams.ProceedWhenDone = true;
//Cannot Configure
status.HardwareDiscoveryStatusInfo.AllDASFound = false;
status.HardwareDiscoveryParams.RequireAllDASFound = true;
//Cannot Download
status.HardwareDiscoveryParams.GoToDownload = false;
//Can Arm
status.HardwareDiscoveryStatusInfo.SomeUnitsInArmState = true;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.Arm));
}
[Test]
public void StateSelector_Should_ReturnHardwareDiscovery()
{
//Arrange
var sut = new HardwareDiscoveryStart();
var status = sut.Status;
status.HardwareDiscoveryParams.ProceedWhenDone = true;
//Cannot Configure
status.HardwareDiscoveryStatusInfo.AllDASFound = false;
status.HardwareDiscoveryParams.RequireAllDASFound = true;
//Cannot Download
status.HardwareDiscoveryParams.GoToDownload = false;
//Can Arm
status.HardwareDiscoveryStatusInfo.SomeUnitsInArmState = false;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.HardwareDiscovery));
}
}
}

View File

@@ -0,0 +1,24 @@
using DTS.DASLib.Service.StateMachine;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StateMachine.Tests
{
[TestFixture]
public class RealtimeShould
{
[Test]
public void State_ShouldBeRealtime()
{
//Arrange
var sut = new Realtime();
//Act & Assert
Assert.That(State.Realtime, Is.EqualTo(sut.State));
}
}
}

View File

@@ -0,0 +1,42 @@
using DTS.DASLib.Service.StateMachine;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StateMachine.Tests
{
[TestFixture]
public class RealtimeStartShould
{
[Test]
public void StateSelector_Should_ReturnRealtimeStart()
{
//Arrange
var sut = new RealtimeStart();
var status = sut.Status;
status.RealtimeStatus.CouldNotStartRealtime = true;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.RealtimeStart));
}
[Test]
public void StateSelector_Should_ReturnRealtime()
{
//Arrange
var sut = new RealtimeStart();
var status = sut.Status;
status.RealtimeStatus.CouldNotStartRealtime = false;
//Act
var dasState = sut.StateSelector();
// Assert
Assert.That(dasState.State, Is.EqualTo(State.Realtime));
}
}
}