https://bugzilla.novell.com/show_bug.cgi?id=385125


           Summary: Delegates don't compare ==
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs@lists.ximian.com
        ReportedBy: [EMAIL PROTECTED]
         QAContact: mono-bugs@lists.ximian.com
          Found By: ---


[TestFixture]
sealed public class DelegateTest
{
    sealed private class EventHandlers
    {
        private EventHandler _handler = DoNothingEventHandler;

        public static EventHandler DoNothingEventHandler
        {
            get
            {
                return delegate{ };
            }
        }

        private int i;
        public EventHandler DoSomethingEventHandler
        {
            get
            {
                return delegate
                {
                    ++i;
                };
            }
        }

        public EventHandler Handler
        {
            get
            {
                return _handler;
            }
            set
            {
                _handler = value;
            }
        }
    }

    [Test]
    public void EqualTestOfInstanceEventHandler()
    {
        EventHandlers handlers = new EventHandlers();
        handlers.Handler = handlers.DoSomethingEventHandler;
        Assert.IsTrue(handlers.Handler == handlers.DoSomethingEventHandler);
    }

    [Test]
    public void EqualTestOfStaticEventHandler()
    {
        EventHandlers handlers = new EventHandlers();
        handlers.Handler = EventHandlers.DoNothingEventHandler;
        Assert.IsTrue(handlers.Handler == EventHandlers.DoNothingEventHandler);
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  mono-bugs@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to