42 lines
2.0 KiB
C#
42 lines
2.0 KiB
C#
using JetBrains.Annotations;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using TBF.Rig.RegisterReaders.PoseidonCmdStartStop;
|
|
|
|
namespace TBFTests.Rig.RegisterReaders.PoseidonCmdStartStop
|
|
{
|
|
[TestClass]
|
|
[TestSubject(typeof(PoseidonReader))]
|
|
public class PoseidonReaderTest
|
|
{
|
|
|
|
[TestMethod]
|
|
public void TryGetDeviceId_Test1()
|
|
{
|
|
string strIn = "{\n \"DeviceId\" : \"1000000267\"\n }";
|
|
PoseidonReader reader = new PoseidonReader();
|
|
bool tryGetDeviceId = reader.TryGetDeviceId(strIn, out string strOut);
|
|
Assert.IsTrue(tryGetDeviceId);
|
|
Assert.AreEqual("1000000267", strOut);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TryGetDeviceId_Test2()
|
|
{
|
|
string strIn = " \"DeviceId\" : \"1000000267\"";
|
|
PoseidonReader reader = new PoseidonReader();
|
|
bool tryGetDeviceId = reader.TryGetDeviceId(strIn, out string strOut);
|
|
Assert.IsTrue(tryGetDeviceId);
|
|
Assert.AreEqual("1000000267", strOut);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TryGetDeviceId_Test3()
|
|
{
|
|
string strIn = "{\n \"NfcTagDetected\": true,\n \"ProductType\": 74,\n \"ProductTypeVersion\": \"B1.0.13\",\n \"DeviceId\": \"1000000267\",\n \"Reading\": \"0003292.1\",\n \"Reading_Totalizer\": \"000329218\",\n \"Reading_Digits\": \"8\",\n \"Reading_Shift\": \"-1\",\n \"Reading_Resolution\": \"-2\",\n \"Reading_Units\": \"2\",\n \"Reading_FlowDirection\": \"3\",\n \"Reading_FlowRate\": \"0\",\n \"CalibrationFactor\": \"3197\",\n \"ReadingComplete\": true,\n \"MeterState\": \"0x02\",\n \"OpticalDataMode\": \"0x00\",\n \"SpreadSpectrumParameters\": \"Disabled: 0xTrue\",\n \"BuildInformation\": \"\"\n}";
|
|
PoseidonReader reader = new PoseidonReader();
|
|
bool tryGetDeviceId = reader.TryGetDeviceId(strIn, out string strOut);
|
|
Assert.IsTrue(tryGetDeviceId);
|
|
Assert.AreEqual("1000000267", strOut);
|
|
}
|
|
}
|
|
} |