[Mono-bugs] [Bug 385125] New: Delegates don't compare ==

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 30 05:08:08 EDT 2008


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 at lists.ximian.com
        ReportedBy: albright at wesay.org
         QAContact: mono-bugs at 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.


More information about the mono-bugs mailing list