Commit Graph

92 Commits

Author SHA1 Message Date
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
Harsh Gupta d0927bdc75 Fixes #2464 - Does not add extra skipped entries for model bound from services.
Also ensures that when a type is marked as skipped, any sub property which is model bound (and hence a modelstate un validated entry),
is marked as skipped (otherwise it would cause the ModelState to be invalid).
Also fixing a bug in model state dictionary FindKeyWithPrefix was not considering [0] & [0][0] as a valid prefix.
2015-05-15 12:27:43 -07:00
Doug Bunting cde4f05d03 Remove ModelBinding project from Mvc.sln
- part of 9fded74 (ModelBinding merge) was undone in b5b3726 (Simple ModelBinders and Simple ModelBinder Poco - 1)
2015-05-04 14:58:58 -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
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
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 e48565dcd8 Adding errors in ModelState 2015-04-22 13:44:09 -07:00
Doug Bunting 4d4686147f Let VS do its thing
- newline after BOM and slight reordering of Mvc.sln
- add `Service/Include` properties to some test .xproj files
 - also add BOM in a few cases
2015-03-28 14:41:40 -07:00
Kevin Dockx f1e1d8f4df Initial Json Patch check-in 2015-03-23 14:46:49 -07:00
Harsh Gupta ac908d405e Removing ModelMetadataProvider.GetModelMetadataForParameters 2015-03-19 16:42:54 -07:00
Harsh Gupta 015edefa96 Cors Support in MVC. 2015-03-18 19:37:00 -07:00
Ryan Nowak fc00aff7c5 Add TestCommon project 2015-03-16 13:49:29 -07:00
N. Taylor Mullen c1a026cbf7 Update .kproj => .xproj. 2015-03-11 14:01:43 -07:00
Ajay Bhargav Baaskaran db728cd386 Introducing TempData
- Issue #455
 - Updated MVC sample
 - Added relevant tests
2015-03-10 12:04:05 -07:00
Doug Bunting e7ee4278a5 Correct case of web site folder and project names
- work around aspnet/DNX#1361 and inconsistent dev boxes (from previous fix attempts)
 - had inconsistent case in test/WebSites and test/WebSites/ConnegWebSite
- ConnegWebsite -> ContentNegotiationWebSite
- RazorInstrumentationWebsite -> RazorPageExecutionInstrumentationWebSite
- RazorViewEngineOptionsWebsite -> RazorEmbeddedViewsWebSite

nits:
- sort dependencies in functional test project.json
- correct a few readme.md files
2015-03-10 09:34:06 -07:00
Mugdha Kulkarni 4f0ba26c79 Adding the test cases for generating lower case URLs 2015-02-20 15:50:58 -08:00
Yishai Galatzer bb31e2aec5 Rename Microsoft.AspNet.PageExecutionInstrumentation to Microsoft.AspNet.PageExecutionInstrumentation.Interfaces 2015-02-19 12:02:29 -08:00
Harsh Gupta f19c2e493d Merging Model Validation for body and non body validation.
This also fixes #1503.

Currently all model binders except mutable object binder are independent of validation code. The mutable object binder which needs to do some validation ( for scenarios involving [BindRequired] and [BindNever]).
We would be going with an approach where required validaiton happens in input formatters and model binders.
This is needed as validation for value types can best be done at creation time.

Followup PRs:
Introduce support for skipping validation (and not binding) for a particular property/type etc.
2015-02-17 11:50:39 -08:00
Ryan Nowak d2aa55893d Functional tests for #302
This feature allows routing to generate a link when the action that is
being linked-to does not yet exist. See the PR in routing for the actual
implementation changes. This PR just has a simple functional test for the
scenario.
2015-02-16 17:59:31 -08:00
Pranav K 5e69d90076 * Modify DefaultControllerTypeProvider to look at the object graph to
determine if any ancestor has the "Controller" suffix.

* Introduce NonControllerAttribute to opt out of Controller detection.

Fixes #1274
2015-02-15 22:11:37 -08:00
Doug Bunting ca65b1b6ed Correct recent checkins
- correct typo in 3303286288
 - really seal `CachedModelMetadata.Properties`
- make a couple of test methods `public` (!!)
- add Microsoft.AspNet.PageExecutionInstrumentation to Mvc.sln
- remove `<RootNamespace/>`, `<ProjectExtensions/>`, etc. from .kproj files
2015-02-12 08:53:17 -08:00
Pranav K e1e43e1e8c ControllerActivator should be able to use controllers registered as
services

* Added WithControllersFromServiceProvider that replaces the default
  controller activator with a service based one.
* Move activation to DefaultControllerFactory
* Modify [Activate] behavior so that it no longer activates services. Use
  [FromService] attribute to hydrate services

Fixes #1707
2015-02-11 16:41:59 -08:00
Pranav K 59db8143da Updating CompilerCache to use IMemoryCache and file system watcher to
expire files in razor file cache.

Add a functional test to ensure the compiler cache does not get
initialized until the first request to a View.

Fixes #1708
2015-02-05 09:52:17 -08:00
Mugdha Kulkarni c8b911b596 Adding functional tests and attribute route tests.
Incorporating PR coments.
2015-01-31 23:15:13 -08:00
Anthony Sneed 1118315a9d [Resolves #1887] XmlDataContractSerializer Input and Output Formatter Tests Cleanup. 2015-01-30 10:02:33 +01:00
Kirthi Krishnamraju cbed666cba Added functionaltests for ModelMetadataType attribute and moved TryValidateModel tests actions to ValidationWebSite 2015-01-27 15:56:49 -08:00
Kiran Challa 5c2dc5db11 [Fixes#1792]Separate XML serializers to Microsoft.AspNet.Mvc.Xml 2015-01-22 15:09:20 -08:00
N. Taylor Mullen 14bd7dcd5e Handle trailing semicolon after @inject.
- Made @inject handle trailing semicolons identical to @using; essentially ignores it.
- Added parser, runtime/designtime codegen and functional tests.
- Added Microsoft.AspNet.Mvc.Common.Test.
- Transitioned pre-existing Microsoft.AspNet.Mvc.Common tests to the new test project.
- Updated transitioned tests to also work in CoreCLR (except ones with moq).

#1857
2015-01-22 14:01:10 -08:00
Harsh Gupta 60fa4a6f45 Adding Support for consumes.
Consumes has overriding behavior and the one closest to action wins.
2015-01-16 14:15:08 -08:00
sornaks 262bb9a732 Changes introducing ResponseCache to cache content in the client/proxy. 2015-01-15 16:51:22 -08:00
Ryan Nowak 623b733eaa Adding a sample (test) for using custom IRouter implementation with MVC
This is a demonstration of how to inject an IRouter in between traditional
routes and MVC's handler. This allows you to accomplish a variety of
things that were possible with WebAPIs handlers, but inside the routing
system.

The example here turns a header representing the user into a locale, which
is used to select a controller. You could do other things like reject the
route match or change link generation.

There is one subtle project change here, to allow the same to be possible
for attribute routing, we need to create the attribute route after running
the user's routing configuration code.
2015-01-15 16:31:21 -08:00
Chris Ross 91d7e382d1 Consume new strongly typed headers. Remove temp implementations. 2015-01-14 15:51:34 -08:00
Pranav K b7d44666b8 Adding support for flowing compilation errors to Diagnostics middleware
Fixes #872
2015-01-13 07:32:58 -08:00
Youngjune Hong f8cb519c2f Adding the functional tests for MvcTagHelpers (1) 2015-01-08 17:23:42 -08:00
Kiran Challa 227f564098 Logging functional tests using ElmLogger 2015-01-06 16:16:12 -08:00
Ajay Bhargav Baaskaran eb7283fced added BadRequest and Created Action Results with related unit and functional tests. 2015-01-05 11:07:42 -08:00
Pranav K e078076408 Adding functional test for RazorViewEngineOptions.FileSystem 2014-12-16 12:08:40 -08:00
Ryan Nowak b4975b779c Update names of WebSite projects for consistency
Project/Assembly names are all like 'FeatureWebSite' root namespaces
updated accordingly. This makes processing all of the functional tests and
deploying the web sites much simpler.
2014-12-11 09:10:24 -08:00
Ryan Nowak 661583f694 Fix for #1447 - Adding functional tests that verify per-request services
These tests verify that per-request services can be injected into assets
that users provide/implements (filters, constraints, controllers, views,
etc).

The purpose is to verify that the services are correctly resolved from the
per-request service container, and don't have state that lingers and
influences the next request. This is important because changing the
lifetime of a framework services could easily impact the lifetimes of
others, and ultimately of something the user created.
2014-11-17 18:38:49 -08:00
Pranav K 3aaeebd9c5 Revert "Revert "Added a functional test for view precompilation""
This reverts commit 6b2ab32885.
2014-10-30 14:38:44 -07:00
jacalvar 6b2ab32885 Revert "Added a functional test for view precompilation"
This reverts commit 310feeb826.
2014-10-28 19:14:50 -07:00
jacalvar 310feeb826 Added a functional test for view precompilation 2014-10-28 18:38:15 -07:00
Pranav K 5119d16b64 ViewComponent.Invoke() should be able to invoke views
Fixes #285
2014-10-17 12:23:18 -07:00
Doug Bunting ba8b3d14a4 Add tests of `TextAreaTagHelper`
- new Microsoft.AspNet.Mvc.TagHelpers.Test project
- bit of test infrastructure -- `TestableHtmlGenerator`
 - short-curcuits validation attribute and AntiForgery additions
 - should help when testing all MVC tag helpers
2014-10-16 21:09:11 -07:00
Doug Bunting a9c2c4c5eb Add `TextAreaTagHelper` and Microsoft.AspNet.Mvc.TagHelpers project
- rest of #1243 and all of #1244
- needs a few utility methods for copying `TagBuilder` to `TagHelperOutput`
 - but works as-is
2014-10-16 21:09:07 -07:00
Doug Bunting 659e759de2 Add TagHelperSample.Web 2014-10-16 21:08:55 -07:00
SonjaKhan 0f5bbdf417 updating ILogger, see aspnet/Logging#3 2014-10-14 10:25:01 -07:00
Ryan Nowak f66345263d Add WebApiCompatShim project structure 2014-10-10 13:41:35 -07:00