Example #1
0
        public void PlotlyConverterTest()
        {
            var testObj = new TestSubplotClass
            {
                Items = new [] { new TestClass {
                                     TestFlag = TestFlag.All
                                 }, new TestClass() }
            };

            var actual = JsonSerializer.Deserialize <JsonElement>(JsonSerializer.Serialize(testObj, serializerOptions));

            Assert.NotNull(actual.GetProperty("Items"));
            Assert.NotNull(actual.GetProperty("Items2"));
            Assert.AreEqual(actual.GetProperty("testProperty").ValueKind, JsonValueKind.String);
            Assert.AreEqual(actual.GetProperty("testProperty2").ValueKind, JsonValueKind.Array);
            Assert.AreEqual(actual.GetProperty("testProperty3").ValueKind, JsonValueKind.String);
        }
Example #2
0
        public void PlotlyConverterTest()
        {
            var expected = new TestSubplotClass
            {
                TestProperty  = "Test",
                TestProperty2 = "Test2",
                TestProperty3 = "Test3",
                Items         = new [] { new TestClass {
                                             TestFlag = TestFlag.All
                                         }, new TestClass() },
            };

            var serialized = JsonSerializer.Serialize(expected, serializerOptions);
            var actual     = JsonSerializer.Deserialize <TestSubplotClass>(serialized);

            expected.Should().BeEquivalentTo(actual);
        }