public void GetValueProvider_ContentTypeDoesNotStartsWithApplicationSlashJson_ReturnsNull()
        {
            _requestFake.Setup(x => x.ContentType).Returns("text/html");
            _httpContextBaseFake.Setup(x => x.Request).Returns(_requestFake.Object);

            var jsonDotNetValueProvider = new JsonDotNetValueProviderFactory().GetValueProvider(_controllerContext);
            Assert.IsNull(jsonDotNetValueProvider);
        }
        public void GetValueProvider_InputStreamIsEmpty_ReturnsNull()
        {
            _requestFake.Setup(x => x.ContentType).Returns("application/json");
            _requestFake.Setup(x => x.InputStream).Returns(Stream.Null);
            _httpContextBaseFake.Setup(x => x.Request).Returns(_requestFake.Object);

            var jsonDotNetValueProvider = new JsonDotNetValueProviderFactory().GetValueProvider(_controllerContext);
            Assert.IsNull(jsonDotNetValueProvider);
        }
        public void GetValueProvider_InputStreamContainsVaildJson_ReturnsCorrectlyMappedDictionaryValueProviderFromDeserializedJson()
        {
            using (var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("{value1:'MyString',value2:100}")))
            {
                _requestFake.Setup(x => x.ContentType).Returns("application/json");
                _requestFake.Setup(x => x.InputStream).Returns(inputStream);
                _httpContextBaseFake.Setup(x => x.Request).Returns(_requestFake.Object);

                var jsonDotNetValueProvider = new JsonDotNetValueProviderFactory().GetValueProvider(_controllerContext);
                Assert.IsInstanceOf<DictionaryValueProvider<object>>(jsonDotNetValueProvider);
                Assert.AreEqual(jsonDotNetValueProvider.GetValue("value1").RawValue, "MyString");
                Assert.AreEqual(jsonDotNetValueProvider.GetValue("value2").RawValue, 100);
            }
        }