public void NoAccess()
 {
     var handler = new SetMessageHandler();
     var mock = new Mock<ScalarObject>(new ObjectIdentifier("1.3.6.1.2.1.1.4.0"));
     mock.Setup(foo => foo.Data).Throws<Exception>();
     mock.Setup(foo => foo.MatchGet(new ObjectIdentifier("1.3.6.1.2.1.1.4.0"))).Returns(mock.Object);
     mock.SetupSet(foo => foo.Data = new OctetString("test")).Throws<AccessFailureException>();
     var store = new ObjectStore();
     store.Add(mock.Object);
     var context = SnmpContextFactory.Create(
         new SetRequestMessage(
             300,
             VersionCode.V1,
             new OctetString("lextm"),
             new List<Variable>
                 {
                     new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.4.0"), new OctetString("test"))
                 }
             ),
         new IPEndPoint(IPAddress.Loopback, 100),
         new UserRegistry(),
         null,
         null);
     handler.Handle(context, store);
     var noAccess = (ResponseMessage)context.Response;
     Assert.AreEqual(ErrorCode.NoAccess, noAccess.ErrorStatus);
 }
 public void NotWritable()
 {
     var handler = new SetMessageHandler();
     var context = SnmpContextFactory.Create(
         new SetRequestMessage(
             300,
             VersionCode.V1,
             new OctetString("lextm"),
             new List<Variable>
                 {
                     new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.4.0"), new OctetString("test"))
                 }
             ),
         new IPEndPoint(IPAddress.Loopback, 100),
         new UserRegistry(),
         null,
         null);
     var store = new ObjectStore();
     handler.Handle(context, store);
     var notWritable = (ResponseMessage)context.Response;
     Assert.AreEqual(ErrorCode.NotWritable, notWritable.ErrorStatus);
 }