From 4f7fc7957121bf22dd059bb1e2b9c2bbfc1cc573 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Fri, 12 Jan 2018 15:07:03 +1300 Subject: [PATCH] -Test --- Src/Newtonsoft.Json.Tests/Issues/Issue1574.cs | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Src/Newtonsoft.Json.Tests/Issues/Issue1574.cs diff --git a/Src/Newtonsoft.Json.Tests/Issues/Issue1574.cs b/Src/Newtonsoft.Json.Tests/Issues/Issue1574.cs new file mode 100644 index 00000000..5ba48401 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Issues/Issue1574.cs @@ -0,0 +1,62 @@ +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using Newtonsoft.Json.Converters; +#if DNXCORE50 +using System.Reflection; +using Xunit; +using Test = Xunit.FactAttribute; +using Assert = Newtonsoft.Json.Tests.XUnitAssert; +#else +using NUnit.Framework; +#endif + +namespace Newtonsoft.Json.Tests.Issues +{ + [TestFixture] + public class Issue1574 : TestFixtureBase + { + [Test] + public void Test() + { + TestClass c = new TestClass(); + string json = JsonConvert.SerializeObject(c, Formatting.Indented); + + Assert.AreEqual("{}", json); + } + + public enum ServerType { STUN, TURN }; + + public class TestClass + { + [JsonIgnore] + public IEnumerable ServerTypes => Enum.GetValues(typeof(ServerType)).Cast(); + } + } +} \ No newline at end of file