Dreamine.FullKit.Tests 1.0.0.0
Dreamine.FullKit.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
Dreamine.FullKit.Tests.IO.FastechProtocolTests 클래스 참조sealed

더 자세히 ...

클래스

class  FakeFastechTransport
class  ThrowingParseProtocol

Public 멤버 함수

void BuildReadDigitalInputs_CreatesExpectedFrameShape ()
void ParseDigitalInputs_ReadsBitsFromInputPayload ()
void BuildWriteDigitalOutputs_RejectsOutOfRangeChannel ()
void PlusE16PointProtocol_ReportsAnalogUnsupportedConsistently ()
void UnsupportedProtocol_ReturnsFailuresForParseMethods ()
async Task Controller_ReturnsFailureWhenParserThrows ()
void FastechOptions_ExposeDefaults ()

상세한 설명

Fastech Protocol Tests 기능과 관련 상태를 캡슐화합니다.

FastechProtocolTests.cs 파일의 18 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ BuildReadDigitalInputs_CreatesExpectedFrameShape()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.BuildReadDigitalInputs_CreatesExpectedFrameShape ( )
inline

Read Digital Inputs Creates Expected Frame Shape 값을 구성합니다.

FastechProtocolTests.cs 파일의 29 번째 라인에서 정의되었습니다.

30 {
31 var frame = new FastechPlusE16PointProtocol()
32 .BuildReadDigitalInputs(new[] { new IoPoint(0, 0) });
33
34 Assert.Equal(0xAA, frame[0]);
35 Assert.Equal(3, frame[1]);
36 Assert.Equal(0x00, frame[3]);
37 Assert.Equal(0xC0, frame[4]);
38 }

◆ BuildWriteDigitalOutputs_RejectsOutOfRangeChannel()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.BuildWriteDigitalOutputs_RejectsOutOfRangeChannel ( )
inline

Write Digital Outputs Rejects Out Of Range Channel 값을 구성합니다.

FastechProtocolTests.cs 파일의 73 번째 라인에서 정의되었습니다.

74 {
75 var protocol = new FastechPlusE16PointProtocol();
76 var values = new Dictionary<IoPoint, bool>
77 {
78 [new IoPoint(0, 16)] = true
79 };
80
81 Assert.Throws<ArgumentOutOfRangeException>(() => protocol.BuildWriteDigitalOutputs(values));
82 }

◆ Controller_ReturnsFailureWhenParserThrows()

async Task Dreamine.FullKit.Tests.IO.FastechProtocolTests.Controller_ReturnsFailureWhenParserThrows ( )
inline

Controller Returns Failure When Parser Throws 작업을 수행합니다.

반환값
Controller Returns Failure When Parser Throws 작업에서 생성한 Task 결과입니다.

FastechProtocolTests.cs 파일의 145 번째 라인에서 정의되었습니다.

146 {
147 var transport = new FakeFastechTransport();
148 await using var controller = new FastechEthernetIoController(
149 new FastechEthernetIoOptions(),
150 transport,
151 new ThrowingParseProtocol());
152
153 await controller.ConnectAsync();
154
155 var result = await controller.DigitalInputs.ReadAsync([new IoPoint(0, 0)]);
156
157 Assert.False(result.IsSuccess);
158 Assert.Contains("parse failed", result.Message);
159 }

◆ FastechOptions_ExposeDefaults()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.FastechOptions_ExposeDefaults ( )
inline

Fastech Options Expose Defaults 작업을 수행합니다.

FastechProtocolTests.cs 파일의 170 번째 라인에서 정의되었습니다.

171 {
172 var options = new FastechEthernetIoOptions();
173
174 Assert.Equal("127.0.0.1", options.Host);
175 Assert.Equal(FastechEthernetIoTransportType.Udp, options.TransportType);
176 }

◆ ParseDigitalInputs_ReadsBitsFromInputPayload()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.ParseDigitalInputs_ReadsBitsFromInputPayload ( )
inline

Parse Digital Inputs Reads Bits From Input Payload 작업을 수행합니다.

FastechProtocolTests.cs 파일의 49 번째 라인에서 정의되었습니다.

50 {
51 var protocol = new FastechPlusE16PointProtocol();
52 var response = new byte[]
53 {
54 0xAA, 12, 1, 0x00, 0xC0, 0x00,
55 0b0000_0101, 0b0000_0010, 0, 0, 0, 0, 0, 0
56 };
57
58 var result = protocol.ParseDigitalInputs(response, 10);
59
60 Assert.True(result.IsSuccess);
61 Assert.Equal(new[] { true, false, true, false, false, false, false, false, false, true }, result.Value);
62 }

◆ PlusE16PointProtocol_ReportsAnalogUnsupportedConsistently()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.PlusE16PointProtocol_ReportsAnalogUnsupportedConsistently ( )
inline

Plus E16 Point Protocol Reports Analog Unsupported Consistently 작업을 수행합니다.

FastechProtocolTests.cs 파일의 93 번째 라인에서 정의되었습니다.

94 {
95 var protocol = new FastechPlusE16PointProtocol();
96 var point = new AnalogIoPoint(0, 0);
97
98 var inputException = Assert.Throws<NotSupportedException>(() => protocol.BuildReadAnalogInputs([point]));
99 var inputParse = protocol.ParseAnalogInputs([], 1);
100 var outputException = Assert.Throws<NotSupportedException>(() => protocol.BuildReadAnalogOutputs([point]));
101 var outputParse = protocol.ParseAnalogOutputs([], 1);
102
103 Assert.Equal(inputException.Message, inputParse.Message);
104 Assert.Equal(outputException.Message, outputParse.Message);
105 Assert.False(inputParse.IsSuccess);
106 Assert.False(outputParse.IsSuccess);
107 }

◆ UnsupportedProtocol_ReturnsFailuresForParseMethods()

void Dreamine.FullKit.Tests.IO.FastechProtocolTests.UnsupportedProtocol_ReturnsFailuresForParseMethods ( )
inline

Unsupported Protocol Returns Failures For Parse Methods 작업을 수행합니다.

FastechProtocolTests.cs 파일의 118 번째 라인에서 정의되었습니다.

119 {
120 var protocol = new UnsupportedFastechEthernetIoProtocol();
121
122 Assert.False(protocol.ParseDigitalInputs(Array.Empty<byte>(), 1).IsSuccess);
123 Assert.False(protocol.ParseDigitalOutputs(Array.Empty<byte>(), 1).IsSuccess);
124 Assert.False(protocol.ParseAnalogInputs(Array.Empty<byte>(), 1).IsSuccess);
125 Assert.Throws<NotSupportedException>(() => protocol.BuildReadDigitalInputs(Array.Empty<IoPoint>()));
126 }

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: