Re: How to test an Exception marked withSerializableAttribute
"Butler, Tony (London)" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <289EBA527A6A47418295E92F70ACFB320350219E@MLLNA225MB.emea.win.ml.com> |
Why don't you just create new SerializationInfo and new StreamingContext instances, call GetObjectData with them and then assert that your custom values have been added to the SerializationInfo collection? You could also construct a new exception with these two objects and then assert that every public property on the new exception contains the same values as every public property on the original exception you called GetObjectData on. cheers, Tony -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Simon Garratt Sent: 31 March 2008 06:38 To: [email protected] Subject: [Nunit-users] How to test an Exception marked withSerializableAttribute I'm building a base exception class and I want to test it but I can't think how. The bit I'm having trouble with is the fourth required constructor - the serializable one. What's the best way to serialize and deserialize it within a test? -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users