Ejemplo n.º 1
0
        public void X2HTest()
        {
//            Assert.Throws<ArgumentOutOfRangeException>(() => AnyRadixConvert.X2H("123", 0));
//            Assert.Throws<ArgumentOutOfRangeException>(() => AnyRadixConvert.X2H("123", 63));
//            Assert.Throws<ArgumentException>(() => AnyRadixConvert.X2H(string.Empty, 2));
//            Assert.Throws<ArgumentException>(() => AnyRadixConvert.X2H("5", 2));
            Assert.AreEqual(AnyRadixConvert.X2H("0", 2), 0UL);
            Assert.AreEqual(AnyRadixConvert.X2H("10", 2), 2UL);
            Assert.AreEqual(AnyRadixConvert.X2H("10", 10), 10UL);
            Assert.AreEqual(AnyRadixConvert.X2H("A", 16), 10UL);
        }
Ejemplo n.º 2
0
 public void X2HTest()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => AnyRadixConvert.X2H("123", 0));
     Assert.Throws <ArgumentOutOfRangeException>(() => AnyRadixConvert.X2H("123", 63));
     Assert.Throws <ArgumentException>(() => AnyRadixConvert.X2H("", 2));
     Assert.Throws <ArgumentException>(() => AnyRadixConvert.X2H("5", 2));
     Assert.Equal(0UL, AnyRadixConvert.X2H("0", 2));
     Assert.Equal(2UL, AnyRadixConvert.X2H("10", 2));
     Assert.Equal(10UL, AnyRadixConvert.X2H("10", 10));
     Assert.Equal(10UL, AnyRadixConvert.X2H("A", 16));
 }