Why T
cannot be a byte[]
?
See the description at
https://msdn.microsoft.com/de-de/library/ms243446.aspx
byte[] one = { 0x1, 0x2, 0x3, 0x4, 0x5 };
byte[] two = { 0x1, 0x2, 0x3, 0x4, 0x5 };
//don't fail
Assert.AreEqual(Convert.ToBase64String(one), Convert.ToBase64String(two));
//fail
Assert.AreEqual<byte[]>(one, two);
You are comparing that one byte array has reference equality with another byte array (i.e. that both variables point to the same array), which in this case they don't.
A better approach is to test using SequenceEqual:
using System.Linq;
Assert.IsTrue(one.SequenceEqual(two));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With