From 26495bf734a6615ebc33a5347ae734d6803c195f Mon Sep 17 00:00:00 2001 From: Joelius300 <52202086+Joelius300@users.noreply.github.com> Date: Fri, 20 Mar 2020 20:43:05 +0100 Subject: [PATCH] Remove json.net playground-class --- ChartJs.Blazor.Tests/ASDF.cs | 72 ------------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 ChartJs.Blazor.Tests/ASDF.cs diff --git a/ChartJs.Blazor.Tests/ASDF.cs b/ChartJs.Blazor.Tests/ASDF.cs deleted file mode 100644 index 8efa2dd3..00000000 --- a/ChartJs.Blazor.Tests/ASDF.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Text; -using Xunit; - -namespace ChartJs.Blazor.Tests -{ - // TODO Remove before merging, this class is just a playground to check json.net behaviour - public class ASDF - { - [JsonConverter(typeof(MyObjConverter))] - class MyObj - { - public object Value { get; set; } - public JsonToken TokenType { get; set; } - } - - class TestObj - { - public MyObj Object { get; set; } - } - - private class MyObjConverter : JsonConverter - { - public override MyObj ReadJson(JsonReader reader, Type objectType, [AllowNull] MyObj existingValue, bool hasExistingValue, JsonSerializer serializer) - { - Console.WriteLine($"Reading into {objectType.FullName}"); - Console.WriteLine($"reader.Value.GetType() = {reader.Value.GetType().FullName}"); - - return new MyObj - { - Value = reader.Value.GetType().FullName, - TokenType = reader.TokenType - }; - } - - public override void WriteJson(JsonWriter writer, [AllowNull] MyObj value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - } - - [Theory] - [InlineData("{\"Object\":\"asdf\"}", "System.String")] - [InlineData("{\"Object\":\"true\"}", "System.String")] - [InlineData("{\"Object\":12}", "System.Int64")] - [InlineData("{\"Object\":-10}", "System.Int64")] - [InlineData("{\"Object\":0}", "System.Int64")] - [InlineData("{\"Object\":100}", "System.Int64")] - [InlineData("{\"Object\":100000}", "System.Int64")] - [InlineData("{\"Object\":100000000}", "System.Int64")] - [InlineData("{\"Object\":10000000000000000000000}", "System.Numerics.BigInteger")] - [InlineData("{\"Object\":50.123}", "System.Double")] - [InlineData("{\"Object\":2.3}", "System.Double")] - [InlineData("{\"Object\":-1.6}", "System.Double")] - [InlineData("{\"Object\":-100.123}", "System.Double")] - [InlineData("{\"Object\":-321321.321321}", "System.Double")] - [InlineData("{\"Object\":true}", "System.Boolean")] - [InlineData("{\"Object\":false}", "System.Boolean")] - [InlineData("{\"Object\":{}}", "System.Object")] - [InlineData("{\"Object\":{\"ABC\":\"EFG\"}}", "System.Object")] - [InlineData("{\"Object\":[]}", "System.Object")] - [InlineData("{\"Object\":[\"asdf\", \"ssss\"]}", "System.Object")] - public void Test(string json, string typeName) - { - TestObj obj = JsonConvert.DeserializeObject(json); - Assert.Equal(typeName, obj.Object.Value as string); - } - } -}