aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2015-06-09 19:30:44 +0100
committerJon Skeet <skeet@pobox.com>2015-06-09 19:30:44 +0100
commite38294a62d7f37c0661273a9a26fda16d557423f (patch)
tree316989251907553408e7b32a12792f496333e075 /csharp/src/ProtocolBuffers.Test/TestCornerCases.cs
parentf52426827e4d5e8da7d205af538799740b5199b9 (diff)
downloadprotobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.gz
protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.tar.bz2
protobuf-e38294a62d7f37c0661273a9a26fda16d557423f.zip
First pass at the mutable API. Quite a bit more to do - in particular, it's pretty slow right now.
Diffstat (limited to 'csharp/src/ProtocolBuffers.Test/TestCornerCases.cs')
-rw-r--r--csharp/src/ProtocolBuffers.Test/TestCornerCases.cs22
1 files changed, 9 insertions, 13 deletions
diff --git a/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs b/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs
index b60e7fae..5897c2f9 100644
--- a/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs
+++ b/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs
@@ -1,25 +1,21 @@
using UnitTest.Issues.TestProtos;
using NUnit.Framework;
-namespace Google.ProtocolBuffers
+namespace Google.Protobuf
{
public class TestCornerCases
{
[Test]
public void TestRoundTripNegativeEnums()
{
- NegativeEnumMessage msg = NegativeEnumMessage.CreateBuilder()
- .SetValue(NegativeEnum.MinusOne) //11
- .AddValues(NegativeEnum.Zero) //2
- .AddValues(NegativeEnum.MinusOne) //11
- .AddValues(NegativeEnum.FiveBelow) //11
- //2
- .AddPackedValues(NegativeEnum.Zero) //1
- .AddPackedValues(NegativeEnum.MinusOne) //10
- .AddPackedValues(NegativeEnum.FiveBelow) //10
- .Build();
+ NegativeEnumMessage msg = new NegativeEnumMessage
+ {
+ Value = NegativeEnum.MinusOne,
+ Values = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
+ PackedValues = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
+ };
- Assert.AreEqual(58, msg.SerializedSize);
+ Assert.AreEqual(58, msg.CalculateSize());
byte[] bytes = new byte[58];
CodedOutputStream output = CodedOutputStream.CreateInstance(bytes);
@@ -27,7 +23,7 @@ namespace Google.ProtocolBuffers
msg.WriteTo(output);
Assert.AreEqual(0, output.SpaceLeft);
- NegativeEnumMessage copy = NegativeEnumMessage.ParseFrom(bytes);
+ NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
Assert.AreEqual(msg, copy);
}
}