I have a class that creates an Image from Byte[] , along with some other logic, and I'm trying to write a unit test that claims that the Image instance returned from my class is the same as some fake Image in my unit test.
I can not find a reliable way:
- Start with fake
Image \ Byte[] \ Resource \ something. - Pass
Byte[] representing the fake thing for my class. - The
Image statement returned from my class matches my fake.
Here is the code that I have provided so far:
Bitmap fakeBitmap = new Bitmap(1, 1); Byte[] expectedBytes; using (var ms = new MemoryStream()) { fakeBitmap.Save(ms, ImageFormat.Png); expectedBytes = ms.ToArray(); }
This always returns false .
source share