How does object.Equals work?
-
5 กรกฎาคม 2555 18:48
I'm doing unit testing, and the following assert keeps failing:
Assert.IsTrue(inflater.Equals(new InflaterInputStream(data)));
inflater contains the object grabbed from new InflaterInputStream(_data) in the code I'm testing and data contains the stream I grabbed from _data.
Is this failing because the two objects have different references?
Thanks for all replies.
- ย้ายโดย Mr. WhartyMicrosoft Community Contributor, Moderator 5 กรกฎาคม 2555 23:06 Not a Training and Certification question (From:Training and Certification)
- ย้ายโดย Jack Zhai - MSFTMicrosoft 13 กรกฎาคม 2555 4:50 Have posted the same issue in the correct forum. (From:Visual Studio Team System - Testing)
ตอบทั้งหมด
-
5 กรกฎาคม 2555 19:46You might want to ask this question in the appropriate MSDN forum. This forum is for questions on Microsoft certification and related training.
-
5 กรกฎาคม 2555 23:05ผู้ดูแลThis is a training and certification forum. As your question relates to neither of these, it will be moved to a more appropriate forum.
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer
Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCSD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
Twitter: @Mr_Wharty
MC ID: Microsoft Transcript -
9 กรกฎาคม 2555 6:19
Hi m4ss,
Thank you for posting in the MSDN forum.
Would you mind sharing us more information about this issue? Did you get any error message when you run your unit test?
About how to use the Assert.IsTrue() method in unit tests, you could see “Assert::IsTrue Method”.
In addition, which kind of app are you testing? Do you mean that you are using the “Class Inflater”?
Since this forum is to discuss the unit test, if still no help, I suggest you share us a simple sample, we will try to check it in our machine.
Please attach your Visual Studio project, you can upload it to the sky driver, and then share the download link in your post. If you got error messages, please also show the whole error messages in your post.
If there's any concern, please feel free to let me know.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
10 กรกฎาคม 2555 15:56
You don't really need my exact code; it's more of a conceptual question.
For example,
Deflater deflater = new Deflater(2);
Deflater def = new Deflater(2);
bool @bool = def.Equals(deflater); // returns falsebut the examples on msdn : http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx
Point3D point3Da = new Point3D(5, 5, 2); Point3D point3Db = new Point3D(5, 5, 2); // point3Da and point3Db are equal
Why do they work the way they do? What's the difference between them?
-
11 กรกฎาคม 2555 6:08
Hi m4ss,
Glad to receive your reply.
It seems that it is the C# issue, I did some research about it, and I found that you have posted this issue in the correct C# forum. It has been resolved here, am I right? If so, I will move this thread to Off-topic forum. Thanks for your understanding.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us