Commit Graph

119 Commits

Author SHA1 Message Date
Pranav K e0116bab30 Modifying ArgumentNullOrEmpty message to be consistent with Mvc 5 \
testing code.
2014-10-27 15:07:53 -07:00
Pranav K 756f8be49c CompositeValueProvider.GetKeysFromPrefixAsync throws null if provider is not an
IEnumerableValueProvider

Fixes #1419
2014-10-23 11:05:06 -07:00
sornaks 1dd1652dcf Issue #220 - Flags enum does not bind
Fix - After TypeConverter support this works. Adding tests for the same.
2014-10-22 13:55:28 -07:00
Ryan Nowak 61f218c8e4 Renaming IBinderMarker and friends to some more descriptive names. 2014-10-17 20:32:03 -07:00
Harsh Gupta d1c0213a10 Adding PropertyFilter instead of depending on model metadata to concatenate Metadata for parameter/property and type metadata 2014-10-17 20:07:33 -07:00
Ryan Nowak df8f84b772 Fix #1287 - Port WebAPI parameter binding behavior
This change modifies the default parameter binding behavior for an
ApiController to use the WebAPI rules.

'simple types' default to use route data or query string
'complex types' default to use the body (formatters)

Adds ModelBindingAttribute to enabled model binding
2014-10-17 16:51:48 -07:00
Harsh Gupta 75405e3b76 Adding support for bind attribute. 2014-10-17 16:24:28 -07:00
jacalvar 98d749d03c [Fixes #1389] Can't bind complex type data from route parameters.
Changed DictionaryBasedValueProvider to do a prefix check instead of just checking if the underlying
dictionary contains the key.
2014-10-17 15:32:21 -07:00
Pranav K 66f626b828 Remove unnecessary references from project.json 2014-10-17 14:26:58 -07:00
sornaks 53379e4395 Issue #1206 - DefaultBodyModelValidator throws if get accessor throws.
Fix: The MvcOptions takes in a list of ExcludeFromValidationDelegate (Func<Type,bool>). This func verifies if the type is excluded in validation or not.
2014-10-16 16:09:30 -07:00
Harsh Gupta 8f933b2ac3 [Fixefor #860]- Adding Support for [FromFormData] [FromQuery] and [FromRoute],
also updates FromBody to use the new pattern for model binding.
2014-10-16 10:20:15 -07:00
Pranav K 0ad959e236 DateTimeOffset doesn't have a TypeConverter in Mono 2014-10-16 07:10:35 -07:00
Hao Kung 448ac5a0dc React to options and hosting changes 2014-10-14 19:20:28 -07:00
sornaks 5fa8a91111 -Issue #913 - Model-binding is being case-sensitive when binding Url data to Enum parameter.
Fix: Using TypeConverter solves this problem.
-Issue #1123 - TypeConverterModelBinder cannot bind "byte" and "short".
Fix: Modified code to use TypeConverter which can handle these scenarios.
-Removing the GetConverterDelegate method and making the code similar to the WebApi.
2014-10-14 15:36:52 -07:00
Pranav K d9ebb37906 Removing Microsoft.AspNet.Mvc dependency from ModelBinding 2014-10-14 12:22:29 -07:00
Pranav K d912f6cd39 Removing unused types
Fixes #1344
2014-10-13 05:15:26 -07:00
Harsh Gupta e319fef5cb Adding CancellationTokenModelBinder. 2014-10-10 12:16:49 -07:00
Hao Kung 6dfcfaa7eb React to options changes 2014-10-08 12:56:53 -07:00
sornaks 5b2948dd73 Excluding a test case in Mono + Fixing a test case. Fixing line lengths. Fixing error messages for tests to pass in Mono. 2014-10-07 11:11:55 -07:00
sornaks f1c1549267 Issue #452: Changes to enable validation for objects generated by InputFormatters. UnitTests + FunctionalTests for the same. 2014-10-06 16:29:56 -07:00
David Fowler 5890b5b254 Fixed up references 2014-10-05 13:24:00 -07:00
Doug Bunting 0d92a829ff Correct minor problem in `CachedDataAnnotationsModelMetadata.ComputeDisplayFormatString()`
- only affects an extreme corner case: user sets `metadata.EditFormatString` then reads
  `metadata.DisplayFormatString`
- an extreme case because `EditFormatString` is normally set only when
  `DisplayFormatString` is set and, if set, it's to the same value
- happened to see this while updating `CachedDataAnnotationsModelMetadata` for this PR

nit: an -> a in an adjacent XML comment in `CachedDataAnnotationsModelMetadata`
2014-10-02 19:13:45 -07:00
Doug Bunting a5600a74a3 Calculate `ModelMetadata.DataTypeName` based on metadata
- helps MVC helpers like `@Html.EditorFor()` select the correct template
- #933

nit: add XML doc for `DataTypeName` in base `ModelMetadata`
2014-10-02 19:13:35 -07:00
Pranav K 3cd5c17da7 Updating ModelBinding tests to work in Mono 2014-09-30 20:16:21 -07:00
Pranav K 646c0d704d Limit the maximum number of Model errors to a reasonable value.
Fixes #490
2014-09-16 09:57:00 -07:00
Wei Wang 44ccea6871 Upgrade Newtonsoft.Json to 6.0.4 version 2014-09-10 08:52:12 -07:00
David Fowler 34add2249e Updated to use the new target framework in project.json 2014-09-04 02:02:40 -07:00
jacalvar b6fb7ac7df Take advantage of nameof to improve our usage of MemberData across the code base.
Substituted all instances of [MemberData("PropertyName")] for [MemberData(nameof(PropertyName))]
This change enables us to take advantage of IDE features like Navigate to source,
find all references, etc. When using Visual Studio.
2014-09-02 13:53:03 -07:00
David Fowler 2e6e5307f6 Updated to use the new target framework in project.json 2014-08-28 22:14:10 -07:00
Pranav K d604c18368 Moving IModelValidatorProvider to Options
Fixes #879
2014-08-26 11:53:32 -07:00
Chris Ross 76ecb73040 Fix abstractions break in tests. 2014-08-20 14:33:39 -07:00
dougbu 98e23075dd Test `DisplayFormatString`, `EditFormatString`, and `HasNonDefaultEditFormat`
- `DisplayFormatString` and `EditFormatString` now based on attributes
- `HasNonDefaultEditFormat` is new
- confirm `DataType` and `ScaffoldColumn` in `CachedDataAnnotationsMetadataAttributes`
2014-08-20 10:07:55 -07:00
dougbu 0595e9ebc9 Move two recently-added `[HiddenInput]` tests into `CachedDataAnnotationsModelMetadataProviderTest` 2014-08-20 10:07:49 -07:00
dougbu 266644560f Clean up `AssociatedMetadataProviderTest`
- remove unused nested class `ModelWithReadOnlyProperty`
- remove unecessary nested classes `RangeAttribute` and `RequiredAttribute`
- use `Assert.NotEmpty()` and `Assert.Single()` where appropriate
2014-08-19 15:49:06 -07:00
harshgMSFT 64d797a489 1. Moving input formatting related classes to MVC Core.(for tests as well).
2. Cleaning up the IInputFormatter to the final version.
3. Updating the input formatters and the context to be compliant with the IInputFormatter interface.
4. Adding Functional Tests.
- Not cleaning up TempInputFormatterProvider.

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/InputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/XmlDataContractSerializerInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/XmlSerializerInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs
	src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/Microsoft.AspNet.Mvc.HeaderValueAbstractions.kproj
	src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
	src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/FormValueProviderFactory.cs
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
	test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/FormattingUtilities.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
2014-08-18 17:07:19 -07:00
harshgMSFT d97a427b3d Adding Input Formatters to MVC Options and using HeaderValueAbstractions 2014-08-18 10:25:19 -07:00
dougbu 1a4bd25e0f Add `[HiddenInput]`, `ModelMetadata.HideSurroundingHtml`, and `.Properties` tests
nits:
- add a few missing default `ModelMetadata` property value checks
- cleanup some redundancies in test data initializers
2014-08-15 12:33:58 -07:00
David Fowler fa6b3acc4a Removed source files from the project 2014-08-15 09:14:49 -07:00
Pranav K 538e589894 Modifying ViewDataDictionary and RouteValueDictionary to copy on write
instead of eagerly copying.

Partial fix for #878
2014-08-14 18:18:54 -07:00
sornaks 9c4d7806a7 Introducing ByteArrayModelBinder.
-Checks for ModelType before processing.
-Ignores quotes in ByteArrayModelBinder.
-Unit,functional Tests.
-ModelStateError is set when Covert.FromBase64String(value) throws.
2014-08-13 15:15:52 -07:00
Pranav K 9d36a45f38 Updating tests using Moq to workaround Roslyn changes
https://roslyn.codeplex.com/workitem/246 affects usage of code with the
latest build of Roslyn with Moq v4.2. The workaround involves ensuring a
closure is created. Updating affected tests to make ToString() calls on
local variables to create these closures.
2014-08-04 17:13:19 -07:00
sornaks cee73c0af3 1. Introducing XML Input Formatters.
2. Adding DelegatingStream class
3. Unit + Functional tests for formatters.
2014-07-29 15:04:23 -07:00
Pranav K da0bf6f7d8 Commonizing code in option provider
* Adding ValueProviderFactoryProvider and CompositeValueProviderFactory to
  maintain parity in pattern with other option types.

Fixes #818
2014-07-25 06:52:00 -07:00
dougbu 3746e44dc3 Add more `ModelMetadata` and HTML helper tests
- add `CachedDataAnnotationsMetadataAttributesTest`
- add `CachedDataAnnotationsModelMetadataTest`
- confirm more default property values in `ModelMetadataTest`
- confirm use of `DisplayName` in `ModelMetadataTest`
- add `HtmlHelperDisplayNameExtensionsTest`
- add `HtmlHelperLabelExtensionsTest`
- add `HtmlHelperNameExtensionsTest`
2014-07-24 18:32:35 -07:00
Pranav K f6106e424e Reacting to System.Collections versioning change 2014-07-14 15:54:00 -07:00
David Fowler 7e7c56ce48 Renamed configurations to frameworks in project.json 2014-07-13 21:58:12 -07:00
Pranav K 2aacdeca4a Modify AssociatedMetadataProvider to use PropertyHelper to create accessor
Additionally change it to use TypeExtensions.GetReadableProperties to get
property list. This causes it to ignore indexers which should not be
considered.

Fixes #595
2014-06-27 10:50:37 -07:00
Pranav K 3c092cb083 Moving model binders from DI to MvcOptions 2014-06-26 21:49:46 -07:00
Chris Ross 3aae5cb4fa Fix one more test. 2014-06-26 11:06:26 -07:00
dougbu 5149c7cd19 Get ModelBinding test project working on K10 again
- restore `ClientRulesWithCompareAttribute_ErrorMessageUsesResourceOverride` since
  DataAnnotations has fixed underlying problem
2014-06-24 19:33:47 -07:00