Files
Essentials/tests/EssentialsTests/CrestronMockTest.cs
2025-08-13 21:15:11 -05:00

87 lines
2.4 KiB
C#

using Crestron.SimplSharpPro;
using Xunit;
namespace EssentialsTests
{
public class CrestronMockTests
{
[Fact]
public void CrestronControlSystem_Constructor_ShouldBuildSuccessfully()
{
// Arrange & Act
var exception = Record.Exception(() => new CrestronControlSystem());
// Assert
Assert.Null(exception);
}
[Fact]
public void CrestronControlSystem_Constructor_ShouldSetPropertiesCorrectly()
{
// Arrange & Act
var controlSystem = new CrestronControlSystem();
// Assert
Assert.NotNull(controlSystem);
Assert.NotNull(controlSystem.ComPorts);
Assert.NotNull(controlSystem.RelayPorts);
Assert.NotNull(controlSystem.IROutputPorts);
Assert.NotNull(controlSystem.DigitalInputPorts);
Assert.NotNull(controlSystem.IRInputPort);
}
[Fact]
public void CrestronControlSystem_InitializeSystem_ShouldNotThrow()
{
// Arrange
var controlSystem = new CrestronControlSystem();
// Act & Assert
var exception = Record.Exception(() => controlSystem.InitializeSystem());
Assert.Null(exception);
}
[Fact]
public void MockControlSystem_ShouldHaveRequiredStaticProperties()
{
// Act & Assert
Assert.NotNull(CrestronControlSystem.NullCue);
Assert.NotNull(CrestronControlSystem.NullBoolInputSig);
Assert.NotNull(CrestronControlSystem.NullBoolOutputSig);
Assert.NotNull(CrestronControlSystem.NullUShortInputSig);
Assert.NotNull(CrestronControlSystem.NullUShortOutputSig);
Assert.NotNull(CrestronControlSystem.NullStringInputSig);
Assert.NotNull(CrestronControlSystem.NullStringOutputSig);
Assert.NotNull(CrestronControlSystem.SigGroups);
}
[Fact]
public void MockControlSystem_ShouldCreateSigGroups()
{
// Act & Assert
var exception = Record.Exception(() =>
{
var sigGroup = CrestronControlSystem.CreateSigGroup(1, eSigType.Bool);
Assert.NotNull(sigGroup);
});
Assert.Null(exception);
}
[Fact]
public void MockControlSystem_VirtualMethods_ShouldNotThrow()
{
// Arrange
var controlSystem = new CrestronControlSystem();
// Act & Assert - just test InitializeSystem since it's definitely available
var exception = Record.Exception(() =>
{
controlSystem.InitializeSystem();
});
Assert.Null(exception);
}
}
}