Commit 134242bc authored by Sydney Acksman's avatar Sydney Acksman

Change input message to UnknownFieldSet tests to proto2 test message to test groups.

parent cd655354
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
using System; using System;
using System.IO; using System.IO;
using Google.Protobuf.TestProtos; using Google.Protobuf.TestProtos;
using Proto2 = Google.Protobuf.TestProtos.Proto2;
using NUnit.Framework; using NUnit.Framework;
namespace Google.Protobuf namespace Google.Protobuf
...@@ -62,13 +63,13 @@ namespace Google.Protobuf ...@@ -62,13 +63,13 @@ namespace Google.Protobuf
[Test] [Test]
public void TestMergeCodedInput() public void TestMergeCodedInput()
{ {
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
var emptyMessage = new TestEmptyMessage(); var emptyMessage = new TestEmptyMessage();
emptyMessage.MergeFrom(message.ToByteArray()); emptyMessage.MergeFrom(message.ToByteArray());
Assert.AreEqual(message.CalculateSize(), emptyMessage.CalculateSize()); Assert.AreEqual(message.CalculateSize(), emptyMessage.CalculateSize());
Assert.AreEqual(message.ToByteArray(), emptyMessage.ToByteArray()); Assert.AreEqual(message.ToByteArray(), emptyMessage.ToByteArray());
var newMessage = new TestAllTypes(); var newMessage = new Proto2.TestAllTypes();
newMessage.MergeFrom(emptyMessage.ToByteArray()); newMessage.MergeFrom(emptyMessage.ToByteArray());
Assert.AreEqual(message, newMessage); Assert.AreEqual(message, newMessage);
Assert.AreEqual(message.CalculateSize(), newMessage.CalculateSize()); Assert.AreEqual(message.CalculateSize(), newMessage.CalculateSize());
...@@ -77,7 +78,7 @@ namespace Google.Protobuf ...@@ -77,7 +78,7 @@ namespace Google.Protobuf
[Test] [Test]
public void TestMergeMessage() public void TestMergeMessage()
{ {
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
var emptyMessage = new TestEmptyMessage(); var emptyMessage = new TestEmptyMessage();
var otherEmptyMessage = new TestEmptyMessage(); var otherEmptyMessage = new TestEmptyMessage();
emptyMessage.MergeFrom(message.ToByteArray()); emptyMessage.MergeFrom(message.ToByteArray());
...@@ -90,7 +91,7 @@ namespace Google.Protobuf ...@@ -90,7 +91,7 @@ namespace Google.Protobuf
[Test] [Test]
public void TestEquals() public void TestEquals()
{ {
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
var emptyMessage = new TestEmptyMessage(); var emptyMessage = new TestEmptyMessage();
var otherEmptyMessage = new TestEmptyMessage(); var otherEmptyMessage = new TestEmptyMessage();
Assert.AreEqual(emptyMessage, otherEmptyMessage); Assert.AreEqual(emptyMessage, otherEmptyMessage);
...@@ -103,7 +104,7 @@ namespace Google.Protobuf ...@@ -103,7 +104,7 @@ namespace Google.Protobuf
[Test] [Test]
public void TestHashCode() public void TestHashCode()
{ {
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
var emptyMessage = new TestEmptyMessage(); var emptyMessage = new TestEmptyMessage();
int hashCode = emptyMessage.GetHashCode(); int hashCode = emptyMessage.GetHashCode();
emptyMessage.MergeFrom(message.ToByteArray()); emptyMessage.MergeFrom(message.ToByteArray());
...@@ -119,7 +120,7 @@ namespace Google.Protobuf ...@@ -119,7 +120,7 @@ namespace Google.Protobuf
Assert.AreEqual(emptyMessage.CalculateSize(), otherEmptyMessage.CalculateSize()); Assert.AreEqual(emptyMessage.CalculateSize(), otherEmptyMessage.CalculateSize());
Assert.AreEqual(emptyMessage.ToByteArray(), otherEmptyMessage.ToByteArray()); Assert.AreEqual(emptyMessage.ToByteArray(), otherEmptyMessage.ToByteArray());
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
emptyMessage.MergeFrom(message.ToByteArray()); emptyMessage.MergeFrom(message.ToByteArray());
otherEmptyMessage = emptyMessage.Clone(); otherEmptyMessage = emptyMessage.Clone();
Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize()); Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize());
...@@ -129,7 +130,7 @@ namespace Google.Protobuf ...@@ -129,7 +130,7 @@ namespace Google.Protobuf
[Test] [Test]
public void TestDiscardUnknownFields() public void TestDiscardUnknownFields()
{ {
var message = SampleMessages.CreateFullTestAllTypes(); var message = SampleMessages.CreateFullTestAllTypesProto2();
var goldenEmptyMessage = new TestEmptyMessage(); var goldenEmptyMessage = new TestEmptyMessage();
byte[] data = message.ToByteArray(); byte[] data = message.ToByteArray();
int fullSize = message.CalculateSize(); int fullSize = message.CalculateSize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment