Example #1
0
        public static void event_with_array_payload()
        {
            var           obj      = new Dummy.TestObject();
            List <string> received = null;

            Eina.Array <string> sent = new Eina.Array <string>();

            sent.Append("Abc");
            sent.Append("Def");
            sent.Append("Ghi");

            obj.EvtWithArrayEvent += (object sender, Dummy.TestObjectEvtWithArrayEventArgs e) => {
                received = e.Arg as List <string>;
            };

            obj.EmitEventWithArray(sent);

            Test.AssertEquals(sent.Count, received.Count);
            var pairs = sent.Zip(received, (string sentItem, string receivedItem) => new { Sent = sentItem, Received = receivedItem });

            foreach (var pair in pairs)
            {
                Test.AssertEquals(pair.Sent, pair.Received);
            }
            sent.Dispose();
            obj.Dispose();
        }