Exemplo n.º 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\"}}");
        }
Exemplo n.º 2
0
        public void RepresentAnEmptyArrayOfResourceObjects()
        {
            var instance = JDocument.For(new JResource[] { });
            var result   = instance.ToString(Newtonsoft.Json.Formatting.None);

            result.Should().Be("{\"data\":[]}");
        }
Exemplo n.º 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}");
        }
Exemplo n.º 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\"}]}");
        }