mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Added more unit tests (#4)
This commit is contained in:
@@ -31,7 +31,7 @@ namespace MewtocolTests {
|
||||
}
|
||||
|
||||
[Fact(DisplayName = nameof(MewtocolHelpers.ToHexString))]
|
||||
public void ToHexStringGeneration() {
|
||||
public void ToHexStringGeneration () {
|
||||
|
||||
var bytes = new byte[6] {
|
||||
0x10,
|
||||
@@ -47,7 +47,7 @@ namespace MewtocolTests {
|
||||
}
|
||||
|
||||
[Fact(DisplayName = nameof(MewtocolHelpers.ToHexASCIIBytes))]
|
||||
public void ToHexASCIIBytesGeneration() {
|
||||
public void ToHexASCIIBytesGeneration () {
|
||||
|
||||
string test = "Hello, world!";
|
||||
|
||||
@@ -69,6 +69,41 @@ namespace MewtocolTests {
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = nameof(MewtocolHelpers.BuildBCCFrame))]
|
||||
public void BuildBCCFrameGeneration () {
|
||||
|
||||
string test = "%01#RCSX0000";
|
||||
string expect = "%01#RCSX00001D";
|
||||
|
||||
Assert.Equal(expect, test.BuildBCCFrame());
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = nameof(MewtocolHelpers.ParseDTByteString))]
|
||||
public void ParseDTByteStringGeneration () {
|
||||
|
||||
var testList = new List<string>() {
|
||||
"1112",
|
||||
"1C2C",
|
||||
"FFFF",
|
||||
};
|
||||
|
||||
foreach (var item in testList) {
|
||||
|
||||
Assert.Equal(item, $"%01$RD{item}".BuildBCCFrame().ParseDTByteString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = nameof(MewtocolHelpers.ParseRCSingleBit))]
|
||||
public void ParseRCSingleBitGeneration () {
|
||||
|
||||
Assert.True($"%01$RC1".BuildBCCFrame().ParseRCSingleBit());
|
||||
Assert.False($"%01$RC0".BuildBCCFrame().ParseRCSingleBit());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user