Example #1
0
        public void RepresentASingleResourceObject()
        {
            var instance = JDocument.For(new JResource("dwarf", "gimly"));
            var result   = instance.ToString(Newtonsoft.Json.Formatting.None);

            result.Should().Be("{\"data\":{\"type\":\"dwarf\",\"id\":\"gimly\"}}");
        }
Example #2
0
        public void RepresentAnEmptyArrayOfResourceObjects()
        {
            var instance = JDocument.For(new JResource[] { });
            var result   = instance.ToString(Newtonsoft.Json.Formatting.None);

            result.Should().Be("{\"data\":[]}");
        }
Example #3
0
        public void RepresentASingleNullResourceObject()
        {
            var instance = JDocument.For(resource: default(JResource));
            var result   = instance.ToString(Newtonsoft.Json.Formatting.None);

            result.Should().Be("{\"data\":null}");
        }
Example #4
0
        public void RepresentAnArrayOfResourceObjects()
        {
            var instance = JDocument.For(new[] {
                new JResource("dwarf", "gimly"),
                new JResource("dwarf", "thorin")
            });
            var result = instance.ToString(Newtonsoft.Json.Formatting.None);

            result.Should().Be("{\"data\":[{\"type\":\"dwarf\",\"id\":\"gimly\"},{\"type\":\"dwarf\",\"id\":\"thorin\"}]}");
        }