Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/0.9.1/ProtobufCS/src/ProtocolBuffers.Test/AbstractMessageTest.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/0.9.1/ProtobufCS/src/ProtocolBuffers.Test/AbstractMessageTest.cs
r3857 r4068 36 36 using System.Collections.Generic; 37 37 using Google.ProtocolBuffers.Descriptors; 38 using Google.ProtocolBuffers.TestProtos; 38 39 using NUnit.Framework; 39 using Google.ProtocolBuffers.TestProtos;40 40 41 41 namespace Google.ProtocolBuffers { … … 46 46 public void Clear() { 47 47 AbstractMessageWrapper message = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder(TestUtil.GetAllSet())).Clear().Build(); 48 TestUtil.AssertClear((TestAllTypes) 48 TestUtil.AssertClear((TestAllTypes)message.WrappedMessage); 49 49 } 50 50 … … 52 52 public void Copy() { 53 53 AbstractMessageWrapper message = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder()).MergeFrom(TestUtil.GetAllSet()).Build(); 54 TestUtil.AssertAllFieldsSet((TestAllTypes) 54 TestUtil.AssertAllFieldsSet((TestAllTypes)message.WrappedMessage); 55 55 } 56 56 … … 73 73 public void Parsing() { 74 74 IBuilder builder = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder()); 75 AbstractMessageWrapper message = (AbstractMessageWrapper) 76 TestUtil.AssertAllFieldsSet((TestAllTypes) 75 AbstractMessageWrapper message = (AbstractMessageWrapper)builder.WeakMergeFrom(TestUtil.GetAllSet().ToByteString()).WeakBuild(); 76 TestUtil.AssertAllFieldsSet((TestAllTypes)message.WrappedMessage); 77 77 } 78 78 … … 167 167 [Test] 168 168 public void MergeFrom() { 169 AbstractMessageWrapper result = (AbstractMessageWrapper) 169 AbstractMessageWrapper result = (AbstractMessageWrapper) 170 170 new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder(MergeDest)) 171 171 .MergeFrom(MergeSource) … … 177 177 // ----------------------------------------------------------------- 178 178 // Tests for equals and hashCode 179 179 180 180 [Test] 181 181 public void EqualsAndHashCode() { … … 187 187 TestAllExtensions f = TestAllExtensions.CreateBuilder(e) 188 188 .AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 999).Build(); 189 189 190 190 CheckEqualsIsConsistent(a); 191 191 CheckEqualsIsConsistent(b); … … 194 194 CheckEqualsIsConsistent(e); 195 195 CheckEqualsIsConsistent(f); 196 196 197 197 CheckNotEqual(a, b); 198 198 CheckNotEqual(a, c); … … 226 226 CheckEqualsIsConsistent(eUnknownFields, eUnknownFields2); 227 227 } 228 228 229 229 /// <summary> 230 230 /// Asserts that the given protos are equal and have the same hash code. … … 233 233 // Object should be equal to itself. 234 234 Assert.AreEqual(message, message); 235 235 236 236 // Object should be equal to a dynamic copy of itself. 237 237 DynamicMessage dynamic = DynamicMessage.CreateBuilder(message).Build(); … … 298 298 return wrappedMessage.HasField(field); 299 299 } 300 300 301 301 public override object this[FieldDescriptor field] { 302 302 get { return wrappedMessage[field]; } … … 310 310 return wrappedMessage.GetRepeatedFieldCount(field); 311 311 } 312 312 313 313 public override UnknownFieldSet UnknownFields { 314 314 get { return wrappedMessage.UnknownFields; } … … 322 322 return new Builder(wrappedMessage.WeakToBuilder()); 323 323 } 324 324 325 325 internal class Builder : AbstractBuilder<AbstractMessageWrapper, Builder> { 326 326 private readonly IBuilder wrappedBuilder;
Note: See TracChangeset
for help on using the changeset viewer.