예제 #1
0
        public void ConvertToBytesTest3()
        {
            var bs = UtilByte.ConvertToBytes("0xFF", string.Empty);

            bs.Length.Should().Be(1);
            bs[0].Should().Be(Convert.ToByte(255));
        }
예제 #2
0
        public void ConvertToBytesTest7()
        {
            var bs = UtilByte.ConvertToBytes("0xFF/0xFF/0xFF/0xFF", "/");

            bs.Length.Should().Be(4);
            bs[0].Should().Be(Convert.ToByte(255));
            bs[1].Should().Be(Convert.ToByte(255));
            bs[2].Should().Be(Convert.ToByte(255));
            bs[3].Should().Be(Convert.ToByte(255));
        }
예제 #3
0
        public void ConvertToBytesTest2()
        {
            var bs = UtilByte.ConvertToBytes("FFFFFFFF", string.Empty);

            bs.Length.Should().Be(4);
            bs[0].Should().Be(Convert.ToByte(255));
            bs[1].Should().Be(Convert.ToByte(255));
            bs[2].Should().Be(Convert.ToByte(255));
            bs[3].Should().Be(Convert.ToByte(255));
        }
예제 #4
0
 public void ConvertToBytesTest9()
 {
     Assert.Throws <ArgumentException>(() => UtilByte.ConvertToBytes("FFF", string.Empty));
 }
예제 #5
0
 public void ConvertToBytesTest8()
 {
     Assert.Throws <FormatException>(() => UtilByte.ConvertToBytes("0xKK/0xFF/0xFF/0xFF", "/"));
 }