public void MetaDataNotIncludedOnEmptyTest()
        {
            var logger = new Mock <ILogger <DefaultMetaDataFilterAttribute> >();
            var defaultMetaDataRetriever = new Mock <IDefaultMetaDataRetriever>();

            defaultMetaDataRetriever.Setup(r => r.GetDefaultMetaData()).Returns(new MetaCollection {
                { "mock", "meta" }
            });
            var target = new DefaultMetaDataFilterAttribute(logger.Object, defaultMetaDataRetriever.Object);

            var responseObject = ApiResponse.OK().AsResponse();

            var context = CreateResultExecutingContext(responseObject);

            target.OnResultExecuting(context);

            var result = (context.Result as ObjectResult).Value as IApiResponse;

            var expected = 0;
            var actual   = result.Meta?.Count(m => m.Key == "mock") ?? 0;

            Assert.Equal(expected, actual);
        }
        public void MetaDataIncludedWithErrorTest()
        {
            var logger = new Mock <ILogger <DefaultMetaDataFilterAttribute> >();
            var defaultMetaDataRetriever = new Mock <IDefaultMetaDataRetriever>();

            defaultMetaDataRetriever.Setup(r => r.GetDefaultMetaData()).Returns(new MetaCollection {
                { "mock", "meta" }
            });
            var target = new DefaultMetaDataFilterAttribute(logger.Object, defaultMetaDataRetriever.Object);

            var responseObject = ApiResponse.OK().WithError(error => error.Status = System.Net.HttpStatusCode.Forbidden).AsItemResponse();

            var context = CreateResultExecutingContext(responseObject);

            target.OnResultExecuting(context);

            var result = (context.Result as ObjectResult).Value as IApiResponse;

            var expected = 1;
            var actual   = result.Meta?.Count(m => m.Key == "mock");

            Assert.Equal(expected, actual);
        }