Commit Graph

1007 Commits

Author SHA1 Message Date
Chris R bd03142dab React to Http namespace changes. 2015-05-07 15:19:10 -07:00
Troy Dai ea717729c1 React to common package name change 2015-05-07 09:39:08 -07:00
Hao Kung 5804856fe2 React to security changes 2015-05-06 22:24:08 -07:00
Chris R 7f737246b1 React to QueryString API changes. 2015-05-06 15:20:40 -07:00
David Fowler 5cec601abe Fix MVC packages being broken on CoreCLR
- Mvc is currently broken on CoreCLR because it is
inheriting dependencies from Microsoft.AspNet.Mvc.Common but the resulting
dependency to Microsoft.AspNet.Mvc.Common is then erased at pack time.
This change moves the dependencies down and makes the shared package
only depend on System.Runtime.

#2507
2015-05-05 23:26:45 -07:00
Ajay Bhargav Baaskaran 0a7b2ac821 [Fixes #2491] RemoveRange handles attributes parameter safely 2015-05-05 14:14:23 -07:00
Kiran Challa c0ca6214c2 React to Caching api changes 2015-05-05 10:08:50 -07:00
Kiran Challa 7e623258c0 Use strongly typed MediaTypeHeaderValue for content type in action results. 2015-05-04 14:06:58 -07:00
Doug Bunting 584015c79b A few quick cleanups
- in .kproj files, let VS mark a couple more test projects as such
- remove duplicate `ModelExpression` class
 - not necessary now that test project references MVC Core project
 - follow up to 9fded74
- avoid `resources` warning in project.json files
2015-05-04 11:55:24 -07:00
Ryan Nowak a5df6679f9 More model binding integration tests
Includes tests for a ValidationAttribute other than RequiredAttribute on
complex models using POCOs and collections
2015-05-04 11:20:52 -07:00
Kiran Challa 284c899233 Register default services directly in AddMvc and remove MvcServices 2015-05-04 10:53:34 -07:00
Harsh Gupta f37f2ae352 Validations with BindRequired on properties. 2015-05-04 10:32:35 -07:00
Harsh Gupta 502b832d17 Integration tests for
Collection Model Binder -> MutableObject(POCO) Model Binder – With-Data/Fallback-to-empty-prefix/Without-Data
2015-05-04 09:52:15 -07:00
Ryan Nowak 1ee5238709 Another batch of ModelBinding integration tests
Includes tests for [Required] on properties with various levels of nesting
inside complex model binders.
2015-05-01 14:22:44 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Pranav K 124496a12f Use DateTimeOffset with fixed time zone in tests to allow it to work in
non-PST timezones.
2015-04-30 21:40:20 -07:00
Harsh Gupta 3a3acde904 Simple ModelBinders and Simple ModelBinder Poco-2
Covers simple scenario for each model binder.
Covers scenarios mixing a POCO model binder -> Simple Model binder.

This contains tests for
FormCollectionModelBinder
BinderTypeBasedModelBinder
TypeConverterModelBinder

Remainging:
TypeMatchModelBinder

This also adds missing unit test for TypeMatchModelBinder as well.
2015-04-30 13:43:02 -07:00
Ryan Nowak 95feb5a3ec ModelBinding Integration tests part 3 2015-04-30 12:45:10 -07:00
Brennan 44bcd36256 React to interface renames 2015-04-30 09:46:13 -07:00
Ryan Nowak 4b686b1234 Part 2 of integration tests for GenericModelBinder
This includes a random sampling of combinations where a collection model
binder is binding another collection as an element type.
2015-04-29 16:52:52 -07:00
Chris R b455724859 Remove redundant Http.Core and Http.Interfaces dependencies. 2015-04-29 15:59:52 -07:00
Ajay Bhargav Baaskaran 89ebce0289 [Fixes #2336] Generate some input elements without value attribute 2015-04-29 13:47:17 -07:00
Kiran Challa 0a1918acac Cleanup logging in tag helpers 2015-04-29 09:41:51 -07:00
Ryan Nowak f77bb0ed2f GenericModelBinder integration tests part 1
- Covers simple scenario for each model binder.
- Covers scenarios mixing a generic model binder with a greedy model
  binder.
2015-04-28 17:43:29 -07:00
Harsh Gupta b5b37265e1 Simple ModelBinders and Simple ModelBinder Poco - 1
Covers simple scenario for each model binder.
Covers scenarios mixing a POCO model binder -> Simple Model binder.

This contains tests for
HeaderModel
ServicesModelBinder
CancellationTokenModelBinder
ByteArrayModelBinder
FormFileModelBinder

Part 2 Will contain similar tests for
FormCollectionModelBinder
BinderTypeBasedModelBinder
TypeConverterModelBinder
TypeMatchModelBinder
Any leftovers for BodyModelBinder
2015-04-28 14:13:36 -07:00
Kirthi Krishnamraju 30e54609cc Fix #1911 : Create a separate package for ApiExplorer 2015-04-28 13:13:20 -07:00
Ajay Bhargav Baaskaran 3ca018375a Issue #1885 - Updated startup code in few websites 2015-04-28 10:42:01 -07:00
Youngjune Hong 3ea7daabfe Added the default constructor to ViewContext 2015-04-27 15:30:18 -07:00
N. Taylor Mullen f152ea7004 React to aspnet/Razor#279 changes.
- Updated all tests and TagHelpers to utilize the new TagHelperOutput.Attributes and TagHelperContext.AllAttribute types.

aspnet/Razor#279
2015-04-27 14:30:30 -07:00
Doug Bunting 05ac641f9a PR comment on c162209
- place `[HtmlAttributeNotBound]` on its own line
 - don't use (wonderful) shortcut syntax
- @Eilon's comment https://github.com/aspnet/Mvc/pull/2452/files#r29162068
2015-04-27 13:32:19 -07:00
Kirthi Krishnamraju 3c9456e2a3 AntiForgery: Add documentation and update variable names for readability 2015-04-27 11:40:59 -07:00
Doug Bunting c1622096b9 React to aspnet/Razor#182 fix
- use `[HtmlAttributeNotBound]` to make tag helper properties `public`
- properties remain invisible in Razor
2015-04-27 08:17:40 -07:00
Doug Bunting 838f672b10 Clean up .xproj files added with HttpAbstractions 2015-04-27 08:12:22 -07:00
Ryan Nowak 9fded74b15 Merging ModelBinding into Mvc.Core 2015-04-27 02:10:37 -07:00
Ryan Nowak 572e57e25c Create Mvc.Abstractions
Creates a new package 'Microsoft.AspNet.Mvc.Abstractions' which defines
APIs and contracts for core concepts and extensibility points in MVC.

Includes:
- ModelBinding
- Validation
- Model State
- Model Metadata
- Action Descriptors
- IActionResult
- Filters
- IActionConstraint
2015-04-27 00:49:14 -07:00
Henk Mollema 955b45f995 Utilized `nameof()` for `ArgumentNullException`s
Utilized the use of nameof() operator for ArgumentNullExceptions.
2015-04-24 14:00:34 -07:00
Chris Ross 98614736a7 React to authentication API changes. 2015-04-24 10:53:50 -07:00
Hao Kung 60fd1f28b9 React to security changes 2015-04-23 23:00:20 -07:00
Doug Bunting 3fd4991959 Bind to readonly non-`null` collections
- part 1/2 of #2294
- handle readonly non-`null` collections in relevant binders
 - `CollectionModelBinder.CopyToModel()` and `MutableObjectModelBinder.AddToProperty()` methods
 - handle read-only controller properties in `DefaultControllerActionArgumentBinder`
 - do not copy into arrays e.g. add `CopyToModel()` override in `ArrayModelBinder`
- remove ability to set a private controller property
 - confirm `SetMethod.IsPublic` in `DefaultControllerActionArgumentBinder`
- avoid NREs in `GetModel()` overrides

Test handling of readonly collections
- previous tests barely touched this scenario
- also add more tests setting controller properties

nits:
- add missing `[NotNull]` attributes
- add missing doc comments
- consolidate a few `[Fact]`s into `[Theory]`s
- simplify some wrapping; shorten a few lines
- remove dead code in `DefaultControllerActionArgumentBinder` and `ControllerActionArgumentBinderTests`
2015-04-23 20:11:09 -07:00
Ajay Bhargav Baaskaran a80a333fea [Fixes #1489] Support for named route in form tag helper 2015-04-23 17:08:38 -07:00
Ajay Bhargav Baaskaran 37e819ce85 [Fixes #2085] Using custom HtmlEncoder in unit tests - part 2 2015-04-23 13:36:54 -07:00
Ajay Bhargav Baaskaran 5da8ba7769 [Fixes #2085] Using custom HtmlEncoder in unit tests 2015-04-23 13:16:27 -07:00
Chris Ross 017e44ae95 Handle FileProviders package changes. 2015-04-23 12:56:10 -07:00
Kiran Challa 687ab258a1 Logging for filters 2015-04-23 06:38:45 -07:00
Ajay Bhargav Baaskaran 1511ea34a8 [Fixes #662] Throw if controller cannot be activated 2015-04-22 16:15:48 -07:00
Harsh Gupta 4df7d52210 PR Comments 2015-04-22 14:40:16 -07:00
Harsh Gupta 86fcacea92 Fix for #2357 : We prevent assigining null values to non nullable controller properties. 2015-04-22 14:40:14 -07:00
Harsh Gupta 53ef8258bb The model state keys for body bound models which are bound at property will use the entire model name with this change for example
Consider

public class Person
{
    [FromBody]
    public Address Address { get; set; }
}

public class Address
{
   [Required]
   public string Street { get; set; }

   public int Zip { get; set; }
}

Request body { "Zip" : 12345 }
In this case the error key would be "prefix.Address.Street" (assuming there is a prefix because of additional metadata/positioning for/of the Person model).

public class Person
{
       [Required]
       public string Name { get; set; }
}

public void Action([FromBody]Person p)
{
}
Request body { }
In this case the prefix gets ignored and the error key is Name.
Please note this is so that we are compatible with MVC 5.0

public class Person
{
       [Required]
       public string Name { get; set; }
}

public void Action([FromBody][ModelBinder(Name = "prefix")] Person p)
{
}

public void Action2([FromBody][Bind(Name = "prefix")] Person p)
{
}
Request body { }
In both these cases (Action and Action2) the prefix gets ignored and the error key is Name.
This is a slight improvement from mvc, as in MVC the action parameter would be null.

The followup for this would be to fix #2416 -
This PR ignores the validation assuming that #2416 will address the issues and update the test.

NOTE: previous versions of mvc did not have property binding and hence there is no precedence in this case. For MVC and Web API it was possible to body bind an action parameter which used an empty prefix instead of a parameter name for adding errors to model state (In case of MVC if a custom prefix was provided, it failed binding from body i.e the parameter was null).
2015-04-22 14:02:08 -07:00
Kirthi Krishnamraju 924d50bd8f Added functionaltests for JsonPatchDocument 2015-04-22 13:44:25 -07:00
Kirthi Krishnamraju bf712263fc Fix for #2280 - Cannot do an "add" patch to IList<Anything>
Added unit tests
2015-04-22 13:44:14 -07:00