Re: Check that all properties match?
"Simone Busoli" <[email protected]> Wed, 27 Aug 2008 23:02:12 +0200
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
Of course Charlie, it wasn't my intention to complain about how NUnit works right now, absolutely. I agree with your observations about the limited availability of an API based on extension methods to pre-3.5 users as well as on the priority of trying to figure out a better object model to reduce duplication. I doubt I will be able to discover anything particularly new because of the little time I can spend on it and mostly due to how little is my experience compared to yours, but as you see whenever somethings pops into my mind I propose it on the mailing list. I'll wait for things to settle down a bit then, since I still can't get where you are going with the constraint model right now. On Wed, Aug 27, 2008 at 10:35 PM, Charlie Poole <[email protected] > wrote: > Hi Simone, > > > There's nothing to prevent integrating new ideas into NUnit via extension methods, but as a > mainstream approach - i.e. for use in release versions of NUnit - it > doesn't work well since > any new features are unavailable for users of pre-.NET 3.5 versions - > which is probably > the majority of users! > > Use of extension methods would make it possible to extend NUnit syntax > without modifying > NUnit, but it would not mitigate the problem of having to make changes in > multiple places. > You would have to supply different extensions for each of the places you > now edit. Of > course, that would be an improvement, but a more significant improvement > would be to > figure out a better object model that reduces duplication. > > My hope is that someone like you, working on a new constraint, will see a > way to improve > the internal structure. Of course, you have to grok it first. :-) > > Another improvement, I must admit, would be for me to document how a new > constraint > gets integrated into NUnit. I plan to do that as soon as things stabilize a > bit. > > Charlie > > ------------------------------ > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Simone Busoli > *Sent:* Wednesday, August 27, 2008 1:00 PM > *To:* Charlie Poole > > *Cc:* [email protected] > *Subject:* Re: [Nunit-users] Check that all properties match? > > It should be trivial to write a simple implementation of such a > constraint. What I'm concerned with is the difficulty of integrating it into > NUnit. As with the Ordered and Serializable constraints, the hard work for > me has been to go everywhere the constraint is going to be needed and > implement all the - mostly syntactic - modifications to the code. That's why > some time ago I proposed a different route, hoping that it could lower the > barrier to implement new constraints. I would love to be able to integrate > new constraints into NUnit via extension methods. > > On Wed, Aug 27, 2008 at 5:24 PM, Charlie Poole < > [email protected]> wrote: > >> With the current syntax, you could do this by writing a comparer that >> used refection and asserting >> Assert.That(x, Is.EqualTo(dummy).Comparer(mycomparer)); >> >> But it would make sense to have it be part of NUnit.... >> Assert.That(x, Is.EqualTo(dummy).AllProperties); >> Or... >> Assert.That(x, Has.AllPropertiesEqualTo(dummy)); >> >> If you search the feature requests, I think you may find that someone has >> asked for this before. >> >> Right now, the syntactic infrastructure is undergoing a bit of flux, but >> we could add the constraint >> easily enough if someone writes it and deal with the parsing aspect later. >> >> Charlie >> >> ------------------------------ >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Simone Busoli >> *Sent:* Wednesday, August 27, 2008 7:38 AM >> *To:* Laimonas Simutis >> *Cc:* [email protected] >> *Subject:* Re: [Nunit-users] Check that all properties match? >> >> Yes. RhinoMocks has an AllPropertiesMatchContraint class which is used >> for the same purpose. Often in tests I need to assert that what I get from a >> method call is equal to a dummy object I passed as input, and I don't want >> to override the Equals method since I need that only during tests. >> >> On Wed, Aug 27, 2008 at 4:22 PM, Laimonas Simutis <[email protected]>wrote: >> >>> Would this be used to compare object equivalency or verifying some >>> sort of cloning? >>> >>> On Wed, Aug 27, 2008 at 3:32 AM, Simone Busoli <[email protected]> >>> wrote: >>> > Hello, would it be useful to have a way to check that all properties >>> with >>> > matching names are equal on two objects? >>> > >>> > >>> ------------------------------------------------------------------------- >>> > This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> > Build the coolest Linux based applications with Moblin SDK & win great >>> > prizes >>> > Grand prize is a trip for two to an Open Source event anywhere in the >>> world >>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> > _______________________________________________ >>> > Nunit-users mailing list >>> > [email protected] >>> > https://lists.sourceforge.net/lists/listinfo/nunit-users >>> > >>> > >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the >>> world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> _______________________________________________ >>> Nunit-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/nunit-users >>> >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Nunit-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/nunit-users >> >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Nunit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-users > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users