Commit 8bd88ea8 authored by csharptest's avatar csharptest Committed by rogerk

Added unit test to repro issue 28

parent 3b625064
......@@ -86,3 +86,12 @@ message NumberField {
optional int32 _01 = 1;
}
// Issue 28: Circular message dependencies result in null defaults for DefaultInstance
message MyMessageAReferenceB {
required MyMessageBReferenceA value = 1;
}
message MyMessageBReferenceA {
required MyMessageAReferenceB value = 1;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using Google.ProtocolBuffers.Collections;
using NUnit.Framework;
using Google.ProtocolBuffers.TestProtos;
using Google.ProtocolBuffers.Serialization;
using UnitTest.Issues.TestProtos;
namespace Google.ProtocolBuffers
{
[TestFixture]
public class ReusableBuilderTest
{
[Test, Description("Issue 28: Circular message dependencies result in null defaults for DefaultInstance")]
public void EnsureStaticCicularReference()
{
MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance;
Assert.IsNotNull(ab);
Assert.IsNotNull(ab.Value);
MyMessageBReferenceA ba = MyMessageBReferenceA.DefaultInstance;
Assert.IsNotNull(ba);
Assert.IsNotNull(ba.Value);
}
[Test]
public void TestModifyDefaultInstance()
{
......
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