public void TestFakeTrapTransform()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrap));

            Assert.IsNotNull(transform);

            var env = new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, "", "", "", null, this.snmpDatagram);
            var key = typeMap.GetInputKey(env);
            var transformedOutput = transform(env) as TrapTypeMapTests.FakeTrap;

            Assert.IsNotNull(transformedOutput);
            Assert.AreEqual(506009u, transformedOutput.SysUpTime);
            Assert.AreEqual(5L, transformedOutput.Integer);
            Assert.IsNotNull(transformedOutput.Objects);
            Assert.AreEqual(4, transformedOutput.Objects.Count);
            Assert.AreEqual(IPAddress.Parse("1.1.1.1"), transformedOutput.SourceAddress);
            Assert.AreEqual(this.snmpDatagram.ReceivedTime, transformedOutput.ReceivedTime);

            var varbinds = transformedOutput.Objects;
            var extraneous = varbinds.FirstOrDefault(vb => vb.Oid.Equals(new ObjectIdentifier("1.3.6.1.6.3.1.1.42.42.42.0")));

            Assert.IsNotNull(extraneous);
            Assert.AreNotEqual(default(VarBind), extraneous);
            Assert.AreEqual(8938ul, extraneous.Value);
        }
        public void TestFakeTrapTransform()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrap));

            Assert.IsNotNull(transform);

            var env = new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, "", "", "", null, this.snmpDatagram);
            var key = typeMap.GetInputKey(env);
            var transformedOutput = transform(env) as TrapTypeMapTests.FakeTrap;

            Assert.IsNotNull(transformedOutput);
            Assert.AreEqual(506009u, transformedOutput.SysUpTime);
            Assert.AreEqual(5L, transformedOutput.Integer);
            Assert.IsNotNull(transformedOutput.Objects);
            Assert.AreEqual(4, transformedOutput.Objects.Count);
            Assert.AreEqual(IPAddress.Parse("1.1.1.1"), transformedOutput.SourceAddress);
            Assert.AreEqual(this.snmpDatagram.ReceivedTime, transformedOutput.ReceivedTime);

            var varbinds   = transformedOutput.Objects;
            var extraneous = varbinds.FirstOrDefault(vb => vb.Oid.Equals(new ObjectIdentifier("1.3.6.1.6.3.1.1.42.42.42.0")));

            Assert.IsNotNull(extraneous);
            Assert.AreNotEqual(default(VarBind), extraneous);
            Assert.AreEqual(8938ul, extraneous.Value);
        }
        public void TestNullTrap()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrap));

            Assert.IsNotNull(transform);

            var transformedOutput = transform(null) as TrapTypeMapTests.FakeTrap;

            Assert.IsNull(transformedOutput);
        }
        public void TestFakeTrapStringIpTransform()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrapStringIp));

            Assert.IsNotNull(transform);

            var env = new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, "", "", "", null, this.snmpDatagram);
            var key = typeMap.GetInputKey(env);
            var transformedOutput = transform(env) as TrapTypeMapTests.FakeTrapStringIp;

            Assert.IsNotNull(transformedOutput);
            Assert.AreEqual("1.1.1.1", transformedOutput.SourceAddress);
        }
        public void TestFakeTrapStringIpTransform()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrapStringIp));

            Assert.IsNotNull(transform);

            var env = new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, "", "", "", null, this.snmpDatagram);
            var key = typeMap.GetInputKey(env);
            var transformedOutput = transform(env) as TrapTypeMapTests.FakeTrapStringIp;

            Assert.IsNotNull(transformedOutput);
            Assert.AreEqual("1.1.1.1", transformedOutput.SourceAddress);
        }
        public void TestNullTrap()
        {
            var typeMap = new SnmpTrapTypeMap();

            var transform = typeMap.GetTransform(typeof(TrapTypeMapTests.FakeTrap));

            Assert.IsNotNull(transform);

            var transformedOutput = transform(null) as TrapTypeMapTests.FakeTrap;

            Assert.IsNull(transformedOutput);
        }