public async Task Serialize_ResourceCollectionDocument_for_primary_data_only_and_metadata()
        {
            var primaryData1 = new Mock<IResourceObject>(MockBehavior.Strict);
            var primaryData2 = new Mock<IResourceObject>(MockBehavior.Strict);
            var mockResourceObjectFormatter = new Mock<IResourceObjectFormatter>(MockBehavior.Strict);
            mockResourceObjectFormatter.Setup(m => m.Serialize(primaryData1.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Primary data 1");
                    return Task.FromResult(0);
                });
            mockResourceObjectFormatter.Setup(m => m.Serialize(primaryData2.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Primary data 2");
                    return Task.FromResult(0);
                });

            var mockMetadata = new Mock<IMetadata>(MockBehavior.Strict);
            var mockMetadataFormatter = new Mock<IMetadataFormatter>(MockBehavior.Strict);
            mockMetadataFormatter.Setup(m => m.Serialize(mockMetadata.Object, It.IsAny<JsonWriter>()))
                .Returns((IMetadata resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Placeholder metadata object");
                    return Task.FromResult(0);
                });

            var primaryData = new[] { primaryData1.Object, primaryData2.Object };
            IResourceCollectionDocument document = new ResourceCollectionDocument(primaryData, null, mockMetadata.Object);

            var formatter = new ResourceCollectionDocumentFormatter(mockResourceObjectFormatter.Object, mockMetadataFormatter.Object);
            await AssertSerializeOutput(formatter, document, "Json/Fixtures/ResourceCollectionDocumentFormatter/Serialize_ResourceCollectionDocument_for_primary_data_only_and_metadata.json");
        }
        public async Task Serialize_ResourceCollectionDocument_for_all_possible_members()
        {
            var primaryData1 = new Mock<IResourceObject>(MockBehavior.Strict);
            var primaryData2 = new Mock<IResourceObject>(MockBehavior.Strict);
            var relatedResource1 = new Mock<IResourceObject>(MockBehavior.Strict);
            var relatedResource2 = new Mock<IResourceObject>(MockBehavior.Strict);
            var relatedResource3 = new Mock<IResourceObject>(MockBehavior.Strict);

            var mockResourceObjectFormatter = new Mock<IResourceObjectFormatter>(MockBehavior.Strict);
            mockResourceObjectFormatter.Setup(m => m.Serialize(primaryData1.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Primary data 1");
                    return Task.FromResult(0);
                });
            mockResourceObjectFormatter.Setup(m => m.Serialize(primaryData2.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Primary data 2");
                    return Task.FromResult(0);
                });
            mockResourceObjectFormatter.Setup(m => m.Serialize(relatedResource1.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Related data object 1");
                    return Task.FromResult(0);
                });
            mockResourceObjectFormatter.Setup(m => m.Serialize(relatedResource2.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Related data object 2");
                    return Task.FromResult(0);
                });
            mockResourceObjectFormatter.Setup(m => m.Serialize(relatedResource3.Object, It.IsAny<JsonWriter>()))
                .Returns((IResourceObject resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Related data object 3");
                    return Task.FromResult(0);
                });

            var mockMetadata = new Mock<IMetadata>(MockBehavior.Strict);
            var mockMetadataFormatter = new Mock<IMetadataFormatter>(MockBehavior.Strict);
            mockMetadataFormatter.Setup(m => m.Serialize(mockMetadata.Object, It.IsAny<JsonWriter>()))
                .Returns((IMetadata resourceObject, JsonWriter writer) =>
                {
                    writer.WriteValue("Placeholder metadata object");
                    return Task.FromResult(0);
                });

            var primaryData = new[] { primaryData1.Object, primaryData2.Object };
            var relatedResources = new[] { relatedResource1.Object, relatedResource2.Object, relatedResource3.Object };
            IResourceCollectionDocument document = new ResourceCollectionDocument(primaryData, relatedResources, mockMetadata.Object);

            var formatter = new ResourceCollectionDocumentFormatter(mockResourceObjectFormatter.Object, mockMetadataFormatter.Object);
            await AssertSerializeOutput(formatter, document, "Json/Fixtures/ResourceCollectionDocumentFormatter/Serialize_ResourceCollectionDocument_for_all_possible_members.json");
        }