private JsonApiFormatter BuildFormatter(ISingleResourceDocumentFormatter singleResourceDocumentFormatter         = null,
                                         IResourceCollectionDocumentFormatter resourceCollectionDocumentFormatter = null,
                                         IErrorDocumentFormatter errorDocumentFormatter = null,
                                         IErrorDocumentBuilder errorDocumentBuilder     = null)
 {
     singleResourceDocumentFormatter     = singleResourceDocumentFormatter ?? new Mock <ISingleResourceDocumentFormatter>(MockBehavior.Strict).Object;
     resourceCollectionDocumentFormatter = resourceCollectionDocumentFormatter ?? new Mock <IResourceCollectionDocumentFormatter>(MockBehavior.Strict).Object;
     errorDocumentFormatter = errorDocumentFormatter ?? new Mock <IErrorDocumentFormatter>(MockBehavior.Strict).Object;
     errorDocumentBuilder   = errorDocumentBuilder ?? new ErrorDocumentBuilder();
     return(new JsonApiFormatter(singleResourceDocumentFormatter, resourceCollectionDocumentFormatter, errorDocumentFormatter, errorDocumentBuilder));
 }
        private JsonApiFormatter BuildFormatter(ISingleResourceDocumentFormatter singleResourceDocumentFormatter = null,
            IResourceCollectionDocumentFormatter resourceCollectionDocumentFormatter = null,
            IErrorDocumentFormatter errorDocumentFormatter = null,
            IErrorDocumentBuilder errorDocumentBuilder = null)
        {

            singleResourceDocumentFormatter = singleResourceDocumentFormatter ?? new Mock<ISingleResourceDocumentFormatter>(MockBehavior.Strict).Object;
            resourceCollectionDocumentFormatter = resourceCollectionDocumentFormatter ?? new Mock<IResourceCollectionDocumentFormatter>(MockBehavior.Strict).Object;
            errorDocumentFormatter = errorDocumentFormatter ?? new Mock<IErrorDocumentFormatter>(MockBehavior.Strict).Object;
            errorDocumentBuilder = errorDocumentBuilder ?? new ErrorDocumentBuilder();
            return new JsonApiFormatter(singleResourceDocumentFormatter, resourceCollectionDocumentFormatter, errorDocumentFormatter, errorDocumentBuilder);
        }
        /// <summary>
        /// Creates a new JsonApiFormatter
        /// </summary>
        public JsonApiFormatter(ISingleResourceDocumentFormatter singleResourceDocumentFormatter,
                                IResourceCollectionDocumentFormatter resourceCollectionDocumentFormatter,
                                IErrorDocumentFormatter errorDocumentFormatter,
                                IErrorDocumentBuilder errorDocumentBuilder)
        {
            _singleResourceDocumentFormatter     = singleResourceDocumentFormatter;
            _resourceCollectionDocumentFormatter = resourceCollectionDocumentFormatter;
            _errorDocumentFormatter = errorDocumentFormatter;
            _errorDocumentBuilder   = errorDocumentBuilder;

            SupportedMediaTypes.Clear();
            SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.api+json"));
        }