public void TestConstructor()
 {
     Integer32 test = new Integer32(100);
     Assert.AreEqual(100, test.ToInt32());
     Assert.Throws<InvalidCastException>(() => test.ToErrorCode());
     Assert.Throws<InvalidCastException>(() => new Integer32(-1).ToErrorCode());
     
     Integer32 test2 = new Integer32(new byte[] {0x00});
     Assert.AreEqual(0, test2.ToInt32());
     
     Integer32 test3 = new Integer32(new byte[] {0xFF});
     Assert.AreEqual(-1, test3.ToInt32());
 }
Esempio n. 2
0
        public void TestConstructor()
        {
            Integer32 test = new Integer32(100);

            Assert.Equal(100, test.ToInt32());
            Assert.Throws <InvalidCastException>(() => test.ToErrorCode());
            Assert.Throws <InvalidCastException>(() => new Integer32(-1).ToErrorCode());

            Integer32 test2 = new Integer32(new byte[] { 0x00 });

            Assert.Equal(0, test2.ToInt32());

            Integer32 test3 = new Integer32(new byte[] { 0xFF });

            Assert.Equal(-1, test3.ToInt32());
        }