using Moq;
|
using WIDESEAWCS_Communicator;
|
using WIDESEAWCS_QuartzJob;
|
using WIDESEAWCS_QuartzJob.ConveyorLine.Enum;
|
using WIDESEAWCS_QuartzJob.DTO;
|
|
namespace WIDESEAWCS_Tests;
|
|
public class CommonConveyorLineTests
|
{
|
[Fact]
|
public void IsOccupied_ShouldReturnTrue_WhenStatusValueMatchesDetailByParamType()
|
{
|
var communicator = new Mock<BaseCommunicator>();
|
communicator.SetupGet(x => x.IsConnected).Returns(true);
|
communicator
|
.Setup(x => x.ReadAsObj(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ushort>()))
|
.Returns("1");
|
|
var devicePros = new List<DeviceProDTO>
|
{
|
new()
|
{
|
DeviceChildCode = "CV01",
|
DeviceProParamType = ConveyorLineStatus.IsOccupied.ToString(),
|
DeviceProParamName = ConveyorLineStatus.CV_State.ToString(),
|
DevicePlcType = "SiemensS7",
|
DeviceProDataBlock = "DB1",
|
DeviceProOffset = 0,
|
DeviceDataType = "Int16"
|
}
|
};
|
|
var protocolDetails = new List<DeviceProtocolDetailDTO>
|
{
|
new()
|
{
|
DeviceProParamName = ConveyorLineStatus.IsOccupied.ToString(),
|
ProtocalDetailValue = "1"
|
}
|
};
|
|
using var conveyorLine = new CommonConveyorLine(
|
communicator.Object,
|
devicePros,
|
protocolDetails,
|
"CV",
|
"Conveyor");
|
|
var occupied = conveyorLine.IsOccupied("CV01");
|
|
Assert.True(occupied);
|
}
|
}
|