public void PortInformationRequestEncoder_Encode(byte portId, PortInformationType informationType, string expectedData) { // arrange var message = new PortInformationRequestMessage(portId, informationType); // act var data = MessageEncoder.Encode(message, null); // assert Assert.Equal(expectedData, BytesStringUtil.DataToString(data)); }
[InlineData(0, PortInformationType.ModeInfo, true, true, true, true, 6, 0x001E, 0x001F, "0B-00-43-00-01-0F-06-1E-00-1F-00")] // Technic Large Motor // identical to line above [InlineData(0, PortInformationType.ModeInfo, true, true, true, true, 6, 0x001E, 0x001F, "0B-00-43-00-01-0F-06-1E-00-1F-00")] // Technic XLarge Motor public void PortInformationEncoder_Decode_PortInformationForModeInfoMessage(byte expectedPort, PortInformationType expectedType, bool expectedOutput, bool expectedInput, bool expectedLogicalCombinable, bool expectedLogicalSynchronizable, byte expectedTotalCount, ushort expectedInputModes, ushort expectedOutputModes, string dataAsString) { // arrange var data = BytesStringUtil.StringToData(dataAsString); // act var message = MessageEncoder.Decode(data, null) as PortInformationForModeInfoMessage; // assert Assert.Equal(expectedPort, message.PortId); Assert.Equal(expectedType, message.InformationType); Assert.Equal(expectedOutput, message.OutputCapability); Assert.Equal(expectedInput, message.InputCapability); Assert.Equal(expectedLogicalCombinable, message.LogicalCombinableCapability); Assert.Equal(expectedLogicalSynchronizable, message.LogicalSynchronizableCapability); Assert.Equal(expectedTotalCount, message.TotalModeCount); Assert.Equal(expectedInputModes, message.InputModes); Assert.Equal(expectedOutputModes, message.OutputModes); }
public PortInformationRequestMessage(byte port, PortInformationType informationType) : base(MessageType.Port_Information_Request, new byte[] { port, (byte)informationType }) { }