public void TestSetGetEvent() { ChaincodeStub stub = new ChaincodeStub("myc", "txId", handler.Object, new List <ByteString>(), null); byte[] payload = new byte[] { 0x10, 0x20, 0x20 }; string eventName = "event_name"; stub.SetEvent(eventName, payload); ChaincodeEvent evnt = stub.Event; Assert.AreEqual(evnt.EventName, eventName); Assert.AreEqual(evnt.Payload, ByteString.CopyFrom(payload)); stub.SetEvent(eventName, null); evnt = stub.Event; Assert.IsNotNull(evnt); Assert.AreEqual(evnt.EventName, eventName); Assert.AreEqual(evnt.Payload, ByteString.CopyFrom(new byte[0])); }
public void TestSetEventNullName() { ChaincodeStub stub = new ChaincodeStub("myc", "txId", handler.Object, new List <ByteString>(), null); stub.SetEvent(null, new byte[0]); }