aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@users.noreply.github.com>2015-04-17 14:15:52 -0700
committerJan Tattermusch <jtattermusch@users.noreply.github.com>2015-04-17 14:15:52 -0700
commit01c8c35ca3d3424a9473dd22ea2456933b3e8d36 (patch)
treede582cb9ef3e449f24015dec09f80e998806b26a /csharp/src/ProtocolBuffersLite.Test/TestUtil.cs
parent813d6d652d8091e9365bfbd01efb5f2ee8bdfbce (diff)
parent1eab56aee8dddcb656db67d9fb87a8cc6a2ac112 (diff)
downloadprotobuf-01c8c35ca3d3424a9473dd22ea2456933b3e8d36.tar.gz
protobuf-01c8c35ca3d3424a9473dd22ea2456933b3e8d36.tar.bz2
protobuf-01c8c35ca3d3424a9473dd22ea2456933b3e8d36.zip
Merge pull request #2 from jtattermusch/csharp_protobuf_imported
Pulling protobuf-csharp-port into csharp/ directory
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);
+ }
+ }
+ }
+ }
+
+ }
+}