Ejemplo n.º 1
0
        public void TestToBytes()
        {
            Gauge32 c0 = new Gauge32(0);
            Gauge32 r0 = (Gauge32)DataFactory.CreateSnmpData(c0.ToBytes());

            Assert.AreEqual(r0, c0);

            Gauge32 c5 = new Gauge32(uint.MaxValue);
            Gauge32 r5 = (Gauge32)DataFactory.CreateSnmpData(c5.ToBytes());

            Assert.AreEqual(r5, c5);

            Gauge32 c4 = new Gauge32(30000000);
            Gauge32 r4 = (Gauge32)DataFactory.CreateSnmpData(c4.ToBytes());

            Assert.AreEqual(r4, c4);

            Gauge32 c3 = new Gauge32(70000);
            Gauge32 r3 = (Gauge32)DataFactory.CreateSnmpData(c3.ToBytes());

            Assert.AreEqual(r3, c3);

            Gauge32 c1 = new Gauge32(13);
            Gauge32 r1 = (Gauge32)DataFactory.CreateSnmpData(c1.ToBytes());

            Assert.AreEqual(r1, c1);

            Gauge32 c2 = new Gauge32(300);
            Gauge32 r2 = (Gauge32)DataFactory.CreateSnmpData(c2.ToBytes());

            Assert.AreEqual(r2, c2);

            Assert.AreEqual(new byte[] { 0x42, 0x01, 0x03 }, new Gauge32(3).ToBytes());
            Assert.AreEqual(new byte[] { 0x42, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00 }, new Gauge32(2147483648).ToBytes());
        }
Ejemplo n.º 2
0
 public void TestToBytes()
 {
     Gauge32 c0 = new Gauge32(0);
     Gauge32 r0 = (Gauge32)DataFactory.CreateSnmpData(c0.ToBytes());
     Assert.AreEqual(r0, c0);
     
     Gauge32 c5 = new Gauge32(uint.MaxValue);
     Gauge32 r5 = (Gauge32)DataFactory.CreateSnmpData(c5.ToBytes());
     Assert.AreEqual(r5, c5);
     
     Gauge32 c4 = new Gauge32(30000000);
     Gauge32 r4 = (Gauge32)DataFactory.CreateSnmpData(c4.ToBytes());
     Assert.AreEqual(r4, c4);
     
     Gauge32 c3 = new Gauge32(70000);
     Gauge32 r3 = (Gauge32)DataFactory.CreateSnmpData(c3.ToBytes());
     Assert.AreEqual(r3, c3);
     
     Gauge32 c1 = new Gauge32(13);
     Gauge32 r1 = (Gauge32)DataFactory.CreateSnmpData(c1.ToBytes());
     Assert.AreEqual(r1, c1);
     
     Gauge32 c2 = new Gauge32(300);
     Gauge32 r2 = (Gauge32)DataFactory.CreateSnmpData(c2.ToBytes());
     Assert.AreEqual(r2, c2);
     
     Assert.AreEqual(new byte[] {0x42, 0x01, 0x03}, new Gauge32(3).ToBytes());
     Assert.AreEqual(new byte[] {0x42, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00}, new Gauge32(2147483648).ToBytes());
 }
Ejemplo n.º 3
0
        public void TestConstructor()
        {
            Gauge32 e    = new Gauge32(3);
            Opaque  test = new Opaque(e.ToBytes());

            Assert.AreEqual(new byte[] { 0x44, 0x03, 0x42, 0x01, 0x03 }, test.ToBytes());
        }
Ejemplo n.º 4
0
 public void TestConstructor()
 {
     Gauge32 e = new Gauge32(3);
     Opaque test = new Opaque(e.ToBytes());
     Assert.AreEqual(new byte[] {0x44, 0x03, 0x42, 0x01, 0x03}, test.ToBytes());
     Assert.AreEqual("42 01 03", test.ToString());
     Assert.Throws<ArgumentNullException>(() => test.AppendBytesTo(null));
 }
Ejemplo n.º 5
0
        public void TestConstructor()
        {
            Gauge32 e    = new Gauge32(3);
            Opaque  test = new Opaque(e.ToBytes());

            Assert.AreEqual(new byte[] { 0x44, 0x03, 0x42, 0x01, 0x03 }, test.ToBytes());
            Assert.AreEqual("42 01 03", test.ToString());
            Assert.Throws <ArgumentNullException>(() => test.AppendBytesTo(null));
        }
Ejemplo n.º 6
0
 public void TestConstructor()
 {
     Gauge32 e = new Gauge32(3);
     Opaque test = new Opaque(e.ToBytes());
     Assert.AreEqual(new byte[] {0x44, 0x03, 0x42, 0x01, 0x03}, test.ToBytes());
 }