public IEnumerator EventsSequentialityTest() { return(ContractTest(async() => { AutoResetEvent waitForEvents = new AutoResetEvent(false); List <int> testEventArguments = new List <int>(); EventHandler <EvmChainEventArgs> handler = (sender, args) => { if (args.EventName != "TestEvent") { waitForEvents.Set(); throw new Exception("args.EventName != TestEvent"); } int val = new IntTypeDecoder(false).DecodeInt(args.Data); testEventArguments.Add(val); if (testEventArguments.Count == 15) { waitForEvents.Set(); } Debug.Log("TestEvent: " + val); }; this.contract.EventReceived += handler; await this.contract.CallAsync("emitTestEvents", 0); waitForEvents.WaitOne(5000); this.contract.EventReceived -= handler; Debug.Log(String.Join(", ", testEventArguments.ToArray())); Assert.AreEqual(15, testEventArguments.Count); Assert.AreEqual(testEventArguments.OrderBy(i => i).ToList(), testEventArguments); })); }
public static int GetNumberOfBytes(byte[] encoded) { var intDecoder = new IntTypeDecoder(); var numberOfBytesEncoded = encoded.Take(32); return(intDecoder.DecodeInt(numberOfBytesEncoded.ToArray())); }
public IntTypeEncoder(bool signed, uint size) { intTypeDecoder = new IntTypeDecoder(); _signed = signed; _size = size; }
public IntTypeEncoder() { intTypeDecoder = new IntTypeDecoder(); }
public IntType(string name) : base(name) { Decoder = new IntTypeDecoder(IsSigned(CanonicalName)); Encoder = new IntTypeEncoder(IsSigned(CanonicalName), GetSize(CanonicalName)); }
public IntType(string name) : base(name) { Decoder = new IntTypeDecoder(); Encoder = new IntTypeEncoder(); }
public IntTypeEncoder() { this.intTypeDecoder = new IntTypeDecoder(); }