Commit Graph

2007 Commits

Author SHA1 Message Date
Doug Bunting a170a4e1e4 Add `ModelBindingContext.IsFirstChanceBinding` and `IsTopLevelObject`
- cleanup duplicate code now that #2445 is fixed
- update unit tests using old `ModelBindingContext` setups
- fix (just) one integration test where `MutableObjectModelBinder` incorrectly calculated
  `isTopLevelObject` and returned a non-`null` model
- undo temporary changes in `BodyModelBinderTests` due to increased reliance on incorrect
  `isTopLevelObject` in #2445 fix

nits:
- combine tests that are now duplicates
- beef up coverage of some `MutableObjectModelBinderTest` cases
- remove unused `using`s
2015-06-24 09:17:29 -07:00
Doug Bunting a8c37e57de Fix build break: React to aspnet/EventNotification#11
- also aspnet/EventNotification@14e8e85
- `NotifierMethodAdapter` was renamed to `ProxyNotifierMethodAdapter`
2015-06-24 09:02:58 -07:00
Doug Bunting 715a0b6021 Add `ModelState` entries for greedy and type-matching model binders
- part II of II for #2445
- `FormCollectionModelBinder` is an exception because container is not user-provided
 - no `ModelState` entry added
- enable tests that #2445 was blocking
 - fix these and other tests expecting different `ModelState` entries
- simplify logic in `FormFileModelBinder`

`ValueProviderResult`
- remove `protected` setters and parameterless constructor
 - no scenario for their use in subclasses; however `ConvertTo()` remains `virtual`
- add single-parameter constructor
 - use in most of the greedy and type-matching model binders
- add doc comments throughout class

nits:
- use new `ValueProviderResult` constructor in many existing tests
- `""` -> `string.Empty` and `vpr` -> `valueProviderResult` in `ValueProviderResultTest`
- improve some test names in `BodyValidationIntegrationTests`
- do not check `Message` of a Json.NET `Exception`
2015-06-23 22:34:55 -07:00
Ajay Bhargav Baaskaran 4a4b8ec87e Made JsonOutputFormatter consistent with JsonInputFormatter 2015-06-23 11:39:59 -07:00
Ajay Bhargav Baaskaran f206cf6759 Removed IJsonOutputFormatter 2015-06-23 11:39:53 -07:00
Ajay Bhargav Baaskaran 5632a33098 Removed unnecessary log statement 2015-06-23 11:12:06 -07:00
Doug Bunting a29188444e Change hardcoded `bash` shebang to `env`
- aspnet/Home#695
- support various `bash` installation locations
- in particular, enable building on FreeBSD
2015-06-23 11:02:33 -07:00
Doug Bunting c4fa402105 Add `ModelBindingResult.IsFatalError` and make body binding more consistent
- part I of II for #2445 (with a duplicate code PR to follow)
- needed for #2445 because new `ModelState` entries for values will make inconsisteny worse
- change `BodyModelBinder` to use same keys for all `ModelBindingResult`s and `ModelState` entries
 - return fatal error result if formatter adds an error to `ModelState`
 - update potential callers to avoid avoid ignoring `IsFatalError`
- fix test attempting to serialize all of `ModelState`
 - will be borked with additional `RawValue`s in state
- fix two other tests that serialized `ModelState` but checked only `IsValid`

nits:
- address minor inconsistencies in `ModelBindingContext`
- use `System.Reflection.Extensions` package a bit more, where it's already referenced
- remove some unused resources
2015-06-18 16:19:01 -07:00
Ajay Bhargav Baaskaran b245996949 [Fixes #2700] Added HttpHeadAttribute 2015-06-17 12:58:02 -07:00
Doug Bunting 27283ec098 Make `string`-based expression evaluations behave consistently
- #1485, #1487
 - handle `TemplateInfo.HtmlFieldPrefix` in `ViewDataEvaluator.Eval()`
  - attempt lookup in the `ViewDataDictionary` using full name then evaluate
    relative `expression` against `viewData.Model`
  - handle `null` or empty `expression` special case in this method (remove `throw`s)
 - always pass relative `expression` name into `Eval()`
  - remove `null` or empty `expression` handling from higher-level code
  - in a couple of cases, special-case returned `ViewDataInfo`
- #2662
 - remove incorrect guard from `DefaultHtmlGenerator.GenerateRadioButtion()`
- add doc comments for the core methods that have changed
- enable unit tests skipped due to one of above bugs
 - fix one (yeah, just one) other test with incorrect expectations
- remove functional test comments about the above bugs and update expectations

nits:
- move some comments describing `ViewDataEvaluator` methods above the methods
2015-06-16 21:54:56 -07:00
Doug Bunting 8b5931d758 Add `Encode()` and `Raw()` overrides to `IHtmlHelper<TModel>`
- #2392
- `dynamic` does not work correctly when inherited from a base `interface`
2015-06-16 18:48:07 -07:00
Ajay Bhargav Baaskaran 4fe3fbabf0 React to aspnet/Diagnostics#142 changes 2015-06-16 11:27:33 -07:00
Ajay Bhargav Baaskaran 69e051dab7 Removed Cors.Core dependency from Mvc.Core 2015-06-16 10:25:27 -07:00
Ajay Bhargav Baaskaran fcdbd17e58 Removed Diagnostics.Abstractions dependency from Mvc.Razor 2015-06-16 10:25:26 -07:00
Ajay Bhargav Baaskaran 6fd8465402 Removed unnecessary cors dependency 2015-06-16 10:25:25 -07:00
Chris R a668f4e1c0 React to HttpResponse.HeadersSent rename. 2015-06-15 18:29:20 -07:00
Doug Bunting 296ec7736e Go one less step when resolving `[ModelMetadataType]`
- #2610
- make MVC 6's attribute consistent with data annotation's `[MetadataType]`, used in MVC 5
2015-06-14 18:02:10 -07:00
Ryan Nowak faaba481e8 Adding an 'AddMinimalMvc()' for Mvc.Core and sample
This adds the ability to configure Mvc.Core for a project; MVC with
minimal services and dependencies.
2015-06-12 11:29:47 -07:00
Ryan Nowak a665e48826 A new pattern for adding multi-registration services
This is some cleanup of how we add multi-registration services to avoid
duplication when calling AddMvcServices multiple times. Also improved
tests to be more clear, and to verify all of our special cases
explicitly.
2015-06-12 11:29:42 -07:00
Ryan Nowak 0861612779 A new pattern for adding multi-registration services
This is some cleanup of how we add multi-registration services to avoid
duplication when calling AddMvcServices multiple times. Also improved
tests to be more clear, and to verify all of our special cases
explicitly.
2015-06-12 11:23:51 -07:00
Hisham Abdullah Bin Ateya 1f9a451e2f Using 'nameof' operator instead of margic strings 2015-06-12 02:26:34 +03:00
Ajay Bhargav Baaskaran a3c593bda9 [Fixes #2409] Return EmptyResult for void actions 2015-06-11 11:51:51 -07:00
N. Taylor Mullen 31aa51ba49 React to aspnet/Razor#172. 2015-06-10 14:43:08 -07:00
Doug Bunting 3f6ab3bb03 Add `ModelMetadata.ElementMetadata`
- #2664
- use new property to correctly determine `isTargetEnum` in `GetCurrentValues()`
 - avoid `ArgumentNullException` in all cases where raw values are `enum` but target is not
- stop skipping tests blocked by #2664, exposing a couple more #1487 issues
- use new property instead of private `GetElementType()` methods where possible
 - cleans up some duplicate code
 - also remove redundant use of `IsCollectionType` and `ElementMetadata`

nits:
- move properties above methods in `ModelMetadata`
- avoid accidentally-incorrect "Remove Unnecessary Usings"
2015-06-10 12:02:50 -07:00
Doug Bunting afd5b4f2a6 Demonstrate #1485, #1487, #2662, #2664 in functional and unit tests
- test additional cases _close_ to these bugs as well

for #1485
- show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests
- show odd `@Html.TextBox()` behaviour in functional tests (templates)

for #1487
- show odd `@Html.Value()` behaviour in unit tests
- show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests
- show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper

for #2662
- show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests

for #2664
- show failures with `@Html.ListBox()` in unit tests

nits:
- test `IHtmlHelper` methods, not extensions
- use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController`
- name test methods a bit more consistently
- rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
2015-06-10 10:22:40 -07:00
Ajay Bhargav Baaskaran 37d1881dad [Fixes #2609] Support for binding all integer types to enums 2015-06-09 16:08:38 -07:00
Ajay Bhargav Baaskaran a40d4aef2b React to aspnet/Diagnostics#140 change 2015-06-09 15:57:09 -07:00
Ryan Nowak a679e87a9b Split Mvc.Core
This is the first step is some more refactorings to come in the future
with the goal of making MVC less monolythic. This makes the core of MVC
more reusable and more in line with the design of other vNext platform
components.

With this change, Mvc.Core contains just the minimal guts needed to build
a working app.
- Action Discovery
- Action Invoker
- Filters
- ObjectResult
- Model Metadata
- Model Binding
- Formatters
- Validation System

And yes, we are aware of the irony of 'minimal MVC' not including the view
system. The idea is that this is the kernel of an MVC app, and anything
real is layered on top.

The most noticable impact of this change is that MvcOptions has been blown
apart into more managable chunks. See the various ConfigureMvc*** methods.

The new Mvc.Extensions package is a placeholder while we evaluate and tune
the new definitions. Expect more changes as features are move to their own
packages, and in some case their own repositories.

For now there is no experience to bootstrap an Mvc.Core app. That's coming
next.
2015-06-09 02:12:13 -07:00
Ryan Nowak 03571cc27b Event Notification for MVC Prototype
Here's a first take on the pattern for publishing notifications from MVC.
2015-06-08 17:49:33 -07:00
Ryan Nowak a452b10ba4 Fix #2278 - Only activate public properties 2015-06-08 15:54:16 -07:00
Ajay Bhargav Baaskaran f5cabf2029 [Fixes #2564] Support comma separated string include in BindAttribute
This reverts commit 7746d0f451.
2015-06-08 14:30:10 -07:00
Ajay Bhargav Baaskaran 7746d0f451 Revert "[Fixes #2609] Support comma separated string include in BindAttribute"
This reverts commit eba352166d.
2015-06-08 14:29:59 -07:00
Ajay Bhargav Baaskaran eba352166d [Fixes #2609] Support comma separated string include in BindAttribute 2015-06-08 14:02:26 -07:00
Kirthi Krishnamraju 12ed69e72a Fix build break: Add HelloWorld.htm to LocalizationWebSite 2015-06-08 12:49:22 -07:00
Kirthi Krishnamraju 74b193b15d Added configurable option for LanguageViewLocationExpander to use subfolder or suffix 2015-06-08 12:07:49 -07:00
Harsh Gupta 67d0bf880a Fixing 2340: ModelMetadata should recompute localizable properties. 2015-06-08 11:07:59 -07:00
Kiran Challa 0469103683 React to Session api review changes 2015-06-08 09:44:05 -07:00
Ryan Nowak 6cd277e8aa Refactor I***ModelBuilder extensibility
Combining IControllerModelBuilder and IActionModelBuilder into a pipeline
of IApplicationModelBuilders. Extensibility for framework features (Auth,
Cors, etc) should implement an IApplicationModelBuilder to add data to
models before IApplicationModelConventions have a chance to run.

Also deleting IGlobalFilterProvider while touching this code, this should
have been removed a while ago when we removed other options facades.
2015-06-07 18:07:41 -07:00
Doug Bunting 261975b0bc Rename `MvcTagHelpersWebSite` to `HtmlGenerationsWebSite`
- name was too specific and I am about to add another HTML helper scenario
2015-06-05 20:30:17 -07:00
Doug Bunting eefa582069 Address #2526; remove use of a required validator when validating `[BindRequired]`
- only use MVC error message when `[BindRequired]` is violated
- update that error message to more clearly describe the problem
- enable all tests skipped due to dupe bug #2493
- update expectations of a few tests using the old messages

nits:
- rename `ModelBinding_MissingRequiredMember` to `ModelBinding_MissingBindRequiredMember`
- remove `<param>` description of removed `requiredValidator` parameter
- remove unused `MutableObjectModelBinderTest.GetRequiredValidator()`
2015-06-05 16:56:05 -07:00
Doug Bunting cda2c6781c Use stable locale when testing date/time formats
- `CultureReplacerMiddleware` no longer helping `RazorWebSite`
 - regressed with @30d11a8
- `[ReplaceCulture]` sets up the correct culture early enough for consistent formatting
- remove `CultureReplacerMiddleware` from `RazorWebSite`
 - only `Startup` class we have that used this with `RequestLocalizationMiddleware`
 - testing `RequestLocalizationMiddleware`; so remove the confusing extra middleware
2015-06-05 14:25:51 -07:00
Kiran Challa bd035714d0 [Fixes #2648]: Fix registration of MVC services 2015-06-05 09:43:40 -07:00
Kirthi Krishnamraju 30d11a8227 Added LanguageViewLocationExpander into framework and removed it from samples 2015-06-04 14:06:08 -07:00
Kiran Challa c1f4bfedab [Fixes #2648]: Fix registration of MVC services 2015-06-03 23:04:03 -07:00
Doug Bunting ffd1dc1fb0 Add support for generating baseline output files while testing
- baselines include both expected output and design-time line mappings
- controlled by GENERATE_BASELINES
 - assertions related to file content are not checked in this mode
- add design-time test of Basic.cshtml to `MvcRazorHostTest`
- regenerate all files to avoid BOM and blank line noise in future PRs
 - update out-of-date design-time Basic.cs file

nits:
- make a few variable names more consistent
- make `Assembly` fields `static`
- remove unused `_resourcesAssembly` field from `ErrorPageTests`
- remove `ResourceHelpers` which was specific to functional tests
2015-06-01 13:13:39 -07:00
Harsh Gupta 386562c269 Enabling test for 2447, CancellationToken does not gets validated. 2015-06-01 12:41:34 -07:00
Doug Bunting e31eab0391 `ByteArrayModelBinder` should return `null` only when type is not matched
- #2456
- visible behaviours now match MVC 5
- prevent `CollectionModelBinder` from converting no value to `byte[0]`
- prevent `TypeConverterModelBinder` from converting empty value to `byte[] { '\0' }`

nit:
- remove additional delegates `ModelBindingTestHelper.GetOperationBindingContext()` calls
 - a few left despite #2625 cleanup
2015-06-01 12:20:17 -07:00
Doug Bunting 26795bd4b5 Correct test expectations
- use valid `multipart/form-data` content type; include a `boundary`
- correct expectations of `FormCollection` model binder's operation
 - restore tests actually skipped for either of the above reasons
- add more tests with `ModelBindingResult.Model==null` and both `IsModelSet` values

#### Remove test references to Won't Fix bug #2473
- restore #2473 tests; update test expectations
- expect `null` composite results whenever binding fails

#### Restore test skipped due to "#2646"
- that issue does not exist; was likely #2466 or similar fixed bug

#### Rename model binding tests that still mention ReturnsFalse or ReturnsTrue

#### Minor src changes
- remove unused variable and unnecessary nesting in `DefaultControllerActionArgumentBinder`
- remove dangling mention of `[DefaultValue]` in `ComplexModelDtoModelBinder`

#### nits:
- remove empty delegates from some `GetOperationBindingContext` calls; `null` fine
- do some `using` cleanup
- combine two test methods in `KeyValuePairModelBinderTest`
- name a few more arguments
2015-06-01 12:15:39 -07:00
N. Taylor Mullen e0b8532735 Update names and spacing of some missed ChunkTree renames. 2015-05-29 23:07:55 -07:00
N. Taylor Mullen 951a1d0879 Addressed code review comments. 2015-05-29 14:59:07 -07:00