public async Task GetValueProvider_ReturnsNull_WhenContentTypeIsNotFormUrlEncoded()
        {
            // Arrange
            var context = CreateContext("some-content-type", formValues: null);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var result = await factory.GetValueProviderAsync(context);

            // Assert
            Assert.Null(result);
        }
Exemple #2
0
        public async Task GetValueProvider_ReturnsNull_WhenContentTypeIsNotFormUrlEncoded()
        {
            // Arrange
            var context = CreateContext("some-content-type", formValues: null);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var result = await factory.GetValueProviderAsync(context);

            // Assert
            Assert.Null(result);
        }
        public async Task GetValueProviderAsync_ReturnsValueProvider_WithCurrentCulture(string contentType)
        {
            // Arrange
            var context = CreateContext(contentType, formValues: null);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var result = await factory.GetValueProviderAsync(context);

            // Assert
            var valueProvider = Assert.IsType<JQueryFormValueProvider>(result);
            Assert.Equal(CultureInfo.CurrentCulture, valueProvider.Culture);
        }
Exemple #4
0
        public async Task GetValueProviderAsync_ReturnsValueProvider_WithCurrentCulture(string contentType)
        {
            // Arrange
            var context = CreateContext(contentType, formValues: null);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var result = await factory.GetValueProviderAsync(context);

            // Assert
            var valueProvider = Assert.IsType <JQueryFormValueProvider>(result);

            Assert.Equal(CultureInfo.CurrentCulture, valueProvider.Culture);
        }
Exemple #5
0
        public async Task GetValueProvider_ReturnsValueProvider_ContainingExpectedKeys(string key)
        {
            // Arrange
            var context = CreateContext("application/x-www-form-urlencoded", formValues: _backingStore);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var valueProvider = await factory.GetValueProviderAsync(context);

            var result = valueProvider.GetValue(key);

            // Assert
            Assert.Equal("found", (string)result);
        }
        public async Task GetValueProvider_ReturnsValueProvider_ContainingExpectedKeys(string key)
        {
            // Arrange
            var context = CreateContext("application/x-www-form-urlencoded", formValues: _backingStore);
            var factory = new JQueryFormValueProviderFactory();

            // Act
            var valueProvider = await factory.GetValueProviderAsync(context);
            var result = valueProvider.GetValue(key);

            // Assert
            Assert.Equal("found", (string)result);
        }