SSPC-Tester/SSPCTester.Tests/BasicTestCriteriaTests.cs

45 lines
1.3 KiB
C#
Raw Normal View History

using SSPCTester.Logic.Testing;
namespace SSPCTester.Tests;
public sealed class BasicTestCriteriaTests
{
[Theory]
[InlineData(1.01, true)]
[InlineData(1.00, false)]
[InlineData(0.99, false)]
public void IsOn_UsesStrictConductingThreshold(double voltage, bool expected)
{
Assert.Equal(expected, BasicTestCriteria.IsOn(voltage));
}
[Theory]
[InlineData(0.49, true)]
[InlineData(-0.49, true)]
[InlineData(0.50, false)]
[InlineData(-0.50, false)]
public void IsOff_UsesAbsoluteVoltageThreshold(double voltage, bool expected)
{
Assert.Equal(expected, BasicTestCriteria.IsOff(voltage));
}
[Theory]
[InlineData(28.0, 1.0, true)]
[InlineData(28.0, 0.0, false)]
[InlineData(0.0, 1.0, false)]
public void IsOnState_RequiresVoltageAndCurrentData(double voltage, double current, bool expected)
{
Assert.Equal(expected, BasicTestCriteria.IsOnState(voltage, current));
}
[Theory]
[InlineData(28.0, 0.0, true)]
[InlineData(28.0, 0.0005, true)]
[InlineData(28.0, 0.01, false)]
[InlineData(0.0, 0.0, false)]
public void IsOffState_RequiresVoltageDataAndNoCurrentData(double voltage, double current, bool expected)
{
Assert.Equal(expected, BasicTestCriteria.IsOffState(voltage, current));
}
}