-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathPortInputFormatCombinedModeEncoderTest.cs
More file actions
28 lines (24 loc) · 1.23 KB
/
Copy pathPortInputFormatCombinedModeEncoderTest.cs
File metadata and controls
28 lines (24 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Linq;
using SharpBrick.PoweredUp.Protocol.Messages;
using SharpBrick.PoweredUp.Utils;
using Xunit;
namespace SharpBrick.PoweredUp.Protocol.Formatter;
public class PortInputFormatCombinedModeEncoderTest
{
[Theory]
[InlineData("07-00-48-00-80-07-00", 0x00, 0x00, true, new int[] { 0, 1, 2 })]
public void PortInputFormatCombinedModeEncoder_Decode(string dataAsString, byte expectedPortId, byte expectedCombinationIndex, bool expectedEnabled, int[] expectedIndexes)
{
// arrange
var data = BytesStringUtil.StringToData(dataAsString);
// act
var message = MessageEncoder.Decode(data, null);
// assert
var portInputFormatCombinedModeMessage = Assert.IsType<PortInputFormatCombinedModeMessage>(message);
Assert.Equal(expectedPortId, portInputFormatCombinedModeMessage.PortId);
Assert.Equal(expectedCombinationIndex, portInputFormatCombinedModeMessage.UsedCombinationIndex);
Assert.Equal(expectedEnabled, portInputFormatCombinedModeMessage.MultiUpdateEnabled);
Assert.Collection(portInputFormatCombinedModeMessage.ConfiguredModeDataSetIndex, expectedIndexes.Select<int, Action<int>>(exp => (act) => Assert.Equal(exp, act)).ToArray());
}
}