-Fixed duplicate type name within an assembly error
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
@@ -4154,5 +4154,29 @@ keyword such as type of business.""
|
||||
Assert.AreEqual("Two", c2.Enumerable.ElementAt(1));
|
||||
Assert.AreEqual("Three", c2.Enumerable.ElementAt(2));
|
||||
}
|
||||
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class ItemBase
|
||||
{
|
||||
[JsonProperty]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class ComplexItem : ItemBase
|
||||
{
|
||||
public Stream Source { get; set; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializeAttributesOnBase()
|
||||
{
|
||||
ComplexItem i = new ComplexItem();
|
||||
|
||||
string json = JsonConvert.SerializeObject(i, Formatting.Indented);
|
||||
|
||||
Assert.AreEqual(@"{
|
||||
""Name"": null
|
||||
}", json);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user