It should work equally well for interfaces and abstract classes. Jeff.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Bryan Slatner Sent: Wednesday, December 09, 2009 8:59 PM To: MbUnit.User Subject: Re: MbUnit Unexpected IsAssignableFrom behavior That seemed to work. I suppose that only works if IFoo is an interface and not an abstract base class? On Dec 9, 2:52 pm, "Jeff Brown" <[email protected]> wrote: > Try IsInstanceOf instead. > > We're redoing IsAssignableFrom because the semantics are indeed a > little weird. IIRC Yann has taken care of it already in the v3.2 branch. > > Jeff. > > -----Original Message----- > From: [email protected] [mailto:[email protected]] > On > > Behalf Of Bryan Slatner > Sent: Tuesday, December 08, 2009 7:15 PM > To: MbUnit.User > Subject: MbUnit Unexpected IsAssignableFrom behavior > > I have a class Foo that implements IFoo. > Assert.IsAssignableFrom(typeof (IFoo), new Foo()) fails. > > Am I misunderstanding the purpose of this assertion? Why does it fail? > > This simple test fixture demonstrates: > > [TestFixture] > public class TestFixture1 > { > private interface IFoo > { > string Value { get; } > } > > private class Foo : IFoo > { > public string Value { get; set; } > } > > [Test] > public void Test() > { > Assert.IsAssignableFrom(typeof(IFoo), new Foo()); > } > } > > -- > > You received this message because you are subscribed to the Google > Groups "MbUnit.User" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group athttp://groups.google.com/group/mbunituser?hl=en. -- You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/mbunituser?hl=en. -- You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/mbunituser?hl=en.
