Testing new Kamstrup format

This commit is contained in:
Roar Fredriksen 2018-03-07 23:01:17 +01:00
parent d58d70c0df
commit a15e2e747a
3 changed files with 16 additions and 0 deletions

View File

@ -70,6 +70,9 @@
<Content Include="SampleData.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Kamstrup228.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -0,0 +1 @@
7E A0 E2 2B 21 13 23 9A E6 E7 00 0F 00 00 00 00 0C 07 E2 03 04 07 14 34 00 FF 80 00 00 02 19 0A 0E 4B 61 6D 73 74 72 75 70 5F 56 30 30 30 31 09 06 01 01 00 00 05 FF 0A 10 35 37 30 36 35 36 37 32 37 34 33 38 39 37 30 32 09 06 01 01 60 01 01 FF 0A 12 36 38 34 31 31 32 31 42 4E 32 34 33 31 30 31 30 34 30 09 06 01 01 01 07 00 FF 06 00 00 0E E7 09 06 01 01 02 07 00 FF 06 00 00 00 00 09 06 01 01 03 07 00 FF 06 00 00 00 00 09 06 01 01 04 07 00 FF 06 00 00 00 BF 09 06 01 01 1F 07 00 FF 06 00 00 05 59 09 06 01 01 33 07 00 FF 06 00 00 01 EC 09 06 01 01 47 07 00 FF 06 00 00 05 14 09 06 01 01 20 07 00 FF 12 00 E1 09 06 01 01 34 07 00 FF 12 00 DD 09 06 01 01 48 07 00 FF 12 00 DE 46 0F 7E

View File

@ -8,6 +8,7 @@ namespace HanDebuggerTest
{
[TestClass]
[DeploymentItem(@"SampleData.txt")]
[DeploymentItem(@"Kamstrup228.txt")]
[DeploymentItem("Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll")]
public class ReaderTest
{
@ -33,5 +34,16 @@ namespace HanDebuggerTest
Assert.IsTrue(reader.IsValid(), $"Data is not valid (Line #{i + 1}): {sample}");
}
}
[TestMethod]
public void TestKamstrup228()
{
var text = File.ReadAllText("Kamstrup228.txt");
byte[] bytes = text.Trim().Split(' ').Select(v => (byte)int.Parse(v, System.Globalization.NumberStyles.HexNumber)).ToArray();
var reader = new Reader(bytes);
Assert.IsTrue(reader.IsValid(), "Data is not valid");
}
}
}