private static void RunTestToUInt32(string hex, uint expected)
        {
            var bytes  = StringToBytesConverter.ConvertToByteArray(hex);
            var result = BigEndianBitConverter.ToUInt32(bytes, 0);

            result.ShouldBe(expected);
        }
        private static void RunTestGetBytesToUInt64(ulong value, string expectedHex)
        {
            var expectedBytes = StringToBytesConverter.ConvertToByteArray(expectedHex);
            var result        = BigEndianBitConverter.GetBytes(value);

            Assert2.AreElementsEqual(expectedBytes, result);
        }
Exemplo n.º 3
0
        private static void RunTestComputeCrcSplit(string input1, string input2, string input3, string input4, long expected)
        {
            var bytes1 = StringToBytesConverter.ConvertToByteArray(input1);
            var bytes2 = StringToBytesConverter.ConvertToByteArray(input2);
            var bytes3 = StringToBytesConverter.ConvertToByteArray(input3);
            var bytes4 = StringToBytesConverter.ConvertToByteArray(input4);

            var crc = Crc24Computer.ComputeCrc(bytes1);

            crc = Crc24Computer.ComputeCrc(bytes2, crc);
            crc = Crc24Computer.ComputeCrc(bytes3, crc);
            crc = Crc24Computer.ComputeCrc(bytes4, crc);

            crc.ShouldBe(expected);
        }
Exemplo n.º 4
0
        private static void TestComputeCrc(string input, long expected)
        {
            var bytes = StringToBytesConverter.ConvertToByteArray(input);

            Crc24Computer.ComputeCrc(bytes).ShouldBe(expected);
        }
Exemplo n.º 5
0
 public void VerifyClrCorrectlyDecodesRadix64()
 {
     Assert2.AreElementsEqual(StringToBytesConverter.ConvertToByteArray("14FB9C03D97E"), Convert.FromBase64String("FPucA9l+"));
     Assert2.AreElementsEqual(StringToBytesConverter.ConvertToByteArray("14FB9C03D9"), Convert.FromBase64String("FPucA9k="));
     Assert2.AreElementsEqual(StringToBytesConverter.ConvertToByteArray("14FB9C03"), Convert.FromBase64String("FPucAw=="));
 }