aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/ProtocolBuffersLite.Test/TestUtil.cs')
-rw-r--r--csharp/src/ProtocolBuffersLite.Test/TestUtil.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs b/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs
new file mode 100644
index 00000000..44c09b9c
--- /dev/null
+++ b/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace Google.ProtocolBuffers
+{
+ class TestUtil
+ {
+ internal static void AssertBytesEqual(byte[] a, byte[] b)
+ {
+ if (a == null || b == null)
+ {
+ Assert.AreEqual<object>(a, b);
+ }
+ else
+ {
+ Assert.AreEqual(a.Length, b.Length, "The byte[] is not of the expected length.");
+
+ for (int i = 0; i < a.Length; i++)
+ {
+ if (a[i] != b[i])
+ {
+ Assert.AreEqual(a[i], b[i], "Byte[] differs at index " + i);
+ }
+ }
+ }
+ }
+
+ }
+}