Commit Graph

186 Commits

Author SHA1 Message Date
Ryan Nowak 6390bad0d3 Adding a pattern for returning 'unhandled' exception information via
middleware.

This should be used where posssible instead of throwing an exception and
catching in a test, as that only works in memory.
2014-12-15 16:29:08 -08:00
Doug Bunting 3e26142de1 Remove use of `Assert.DoesNotThrow()`
- no longer in xunit 😃
2014-12-11 15:51:15 -08:00
Ryan Nowak f338f70e06 Update WebAPI shim functional tests to use a header for payload
The issue is that responses to HEAD cannot have a body. When running these
tests on a real server, they break because the server throws when you try
to write to the body.
2014-12-11 09:18:05 -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 1631ca1a47 Fix for #1681 - Model state errors are wrong with attributes like [FromHeader]
The issue here is that a model state error is added with the model name
'doubled'. This is on a fairly obscure code path and the code dates back
to the original WSR git checkin of webapi. There are no wsr tests that
verify this behavior.

The cause here is that our 'greedy' model binders (like
FromHeaderModelBinder) return 'true' whether or not they successfully
found a model, because they don't want other model binders to run.

This also has an effect on the validation system. That means that
validators will run and attempt to validate the model (which may be null).
That's that rare case where we get to this code path.
2014-12-10 14:03:51 -08:00
Ryan Nowak 9468d741ee Fix for #1671 - Adding [FromHeader] attribute 2014-12-08 11:42:57 -08:00
Harsh Gupta d7094fd32d Adding Support for TryUpdateModel using include expressions and predicate. 2014-12-05 17:28:43 -08:00
Ryan Nowak ca714c5149 CR feedback from [ModelBinderAttribute] 2014-12-05 16:10:07 -08:00
Doug Bunting f94bd53464 Add functional test of MVC tag helper sample
- ensure future changes don't break this sample
2014-12-05 15:48:43 -08:00
Pranav K 6ec85baa22 Fixing build break
Change the casing of _ViewStart.cshtml to match the expected case.
2014-12-05 15:16:27 -08:00
Pranav K 275d03a958 Compilation of Views should be affected by changes to _ViewStart files
that are applicable to the view.

Fixes #974
2014-12-05 14:44:36 -08:00
Harsh Gupta e9bcc3f0e8 Adding support for ModelMetadataAttribute in core. 2014-12-05 12:00:19 -08:00
Mugdha Kulkarni ba8cf3ca46 Changed to use OptionalRouteConstraint created by Routing to use for inline optional parameters in attribute routing. Also added tests for inline parameters. 2014-12-04 11:00:48 -08:00
Kiran Challa 00b61ec1e6 [Partial fix for #1372]Added SimpleTypesExcludeFilter to exlcude validation on simple types and also added tests to cover scenarios. 2014-12-03 14:09:51 -08:00
Victor Hurdugaci d788e87a94 React to DI changes part 2 2014-12-03 13:36:54 -08:00
Pranav K 933f7eeb22 Layout specification and discovery should follow the same behavior as
partials

Fixes #1047
2014-12-03 11:54:46 -08:00
Praburaj cfd5630cf2 Addressing breaking IFileSystem changes
@pranavkm
2014-12-02 15:58:05 -08:00
Ryan Nowak 0152aac7f4 Fix for #1652 - Make Authorization Filters run first
This change moves authorization filters to be the first filter stage
(before exception filters).
2014-12-02 10:39:50 -08:00
Harsh Gupta 2353bd911a Adding Support for TryUpdateModel using include expressions and predicate. 2014-11-26 17:44:50 -08:00
Harsh Gupta d2aff42e25 Adding FromServicesAttribute. 2014-11-26 15:35:08 -08:00
Ajay Bhargav Baaskaran 9f1cb655f6 matched classnames with filenames 2014-11-25 11:21:17 -08:00
Victor Hurdugaci 99b5f430ff Add schema version to kproj files 2014-11-25 10:57:58 -08:00
Harsh Gupta d00c7ef597 Adding support for property level binding using IBinderMetadata and enabling FromXXX attributes to be decorated on properties. 2014-11-24 21:33:02 -08:00
Doug Bunting 823229279a Extend MVC Sample functional test to include all Home views 2014-11-22 10:36:46 -08:00
Ryan Nowak e54bf866e0 Simplifying InlineConstraints tests
Right now these use a commandline adapter to inject some data into the
tests, but it's really not needed. Instead, these routes use a prefix to
ensure that the scenario under test is isolated.
2014-11-21 11:28:44 -08:00
Doug Bunting 7eb106676c Add missing license headers
- #EngineeringDay
- license present but incorrect in just a few files
- skip generated files such as Resources.Designer.cs and files under
  test\Microsoft.AspNet.Mvc.Razor.Host.Test\TestFiles\Output
2014-11-20 22:54:05 -08:00
Doug Bunting 315908af5f Apply VS' FormatDocument and RemoveAndSort to all *.cs files
- #EngineeringDay
- VS does not yet format auto-properties nicely; reverted what it did

Also revert changes under
- test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles
2014-11-20 21:15:46 -08:00
Ryan Nowak eb6598e1b9 Fix flaky NoContentFormatter test 2014-11-20 17:48:00 -08:00
Hao Kung d9893b260a React to fallback changes 2014-11-20 17:43:55 -08:00
Doug Bunting 5e067cdb9e Delete trailing whitespace
- #EngineeringDay
- Total replaced: 660  Matching files: 270 in *.cs
- Total replaced: 250  Matching files: 32 in all other files
- Total replaced: 22  Matching files: 8 in a few stragglers

Did not change files under following directories
- test\Microsoft.AspNet.Mvc.Razor.Host.Test\TestFiles\Output
- test\Microsoft.AspNet.Mvc.FunctionalTests\compiler\resources
- test\WebSites\TagHelpersWebSite
(Razor generates trailing whitespace in a case or two)
2014-11-20 16:18:09 -08:00
Ryan Nowak 7c961e3ce8 TODO removal
For each of these TODOs:

- If there's an active bug tracking the work, and the TODO provides
  something of value, I left it and standardized the formatting. I also
  added comments to the bug.

- If the comment provided no value (implement feature X when we do feature
  X), I deleted it with impunity.

- If the comment was stale (won't fix or just out of date), then we
  removed it uncerimoniously.

There was a single TODO that was actually actionable, so I enabled that
test.
2014-11-20 15:01:35 -08:00
Ryan Nowak ed8ba5ae9c Fix for #1194 - Error using [HttpPost] and [Route] together
This change enables some compatibility scenarios with MVC 5 by expanding
the set of legal ways to configure attribute routing. Most promiently, the
following example is now legal:

[HttpPost]
[Route("Products")]
public void MyAction() { }

This will define a single action that accepts POST on route "Products".

See the comments in #1194 for a more detailed description of what changed
with more examples.
2014-11-19 15:52:20 -08:00
Ryan Nowak 38b3b61485 update due to breaking changes in routing 2014-11-18 12:37:47 -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
Ryan Nowak ca92700a6f Adding a functional test that modifies data tokens
Tracked by aspnet/Routing#116

The product support for this feature is in already this change just adds a
test verifying the scenario.
2014-11-17 18:35:04 -08:00
Pranav K 052ad3e95f RenderSection \ RenderSectionAsync does not work in sections
Fixes #1509
2014-11-14 12:17:25 -08:00
Ryan Nowak e9d8c845d6 Create a new routedata for each 'router' for MVC
This is the MVC companion to https://github.com/aspnet/Routing/pull/122

As routing flows, routes replace the route data and mutate a copy. This
allows users to make changes that dirty the data without affecting
undesired state changes.

We also add the 'next' router for diagnostic purposes.
2014-11-12 11:10:21 -08:00
Ajay Bhargav Baaskaran 232deb47d0 added tests for json input formatter 2014-11-12 10:50:55 -08:00
Kiran Challa 17e4dd2bf6 [Fixes #1429] Content negotiation does a case-sensitive matching of media type's parameter values 2014-11-11 10:15:51 -08:00
Harsh Gupta 6b2f331e8d Adding support for excluding types for validation, based on type names for body bound models. 2014-11-06 11:00:50 -08:00
SonjaKhan 27e0323a8a renaming TraceType to LogLevel 2014-11-06 09:24:02 -08:00
Doug Bunting f7ef604b86 Regenerate .kproj files
- does not seem to have a negative impact
- e.g. sample web projects run / debug fine
2014-11-04 22:41:53 -08:00
Ryan Nowak 105c99cbf2 Fix #1370 - Always use the provided formatter in JsonResult
The change here is to always use the provided formatter, instead of using
it as a fallback. This is much less surprising for users.

There are some other subtle changes here and cleanup of the tests, as well
as documentation additions.

The primary change is that we still want to run 'select' on a formatter
even if it's the only one. This allows us to choose a content type based
on the accept header.

In the case of a user-provided formatter, we'll try to honor the best
possible combination of Accept and specified ContentTypes (specified
ContentTypes win if there's a conflict). If nothing works, we'll still run
the user-provided formatter and let it decide what to do.

In the case of the default (formatters from options) we do conneg, and if
there's a conflict, fall back to a global (from services)
JsonOutputFormatter - we let it decide what to do.

This should leave us with a defined and tested behavior for all cases.
2014-10-31 14:30:31 -07:00
sornaks d178200795 Adding functional tests for Filters. 2014-10-31 08:36:31 -07: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
Ryan Nowak 83187945d1 Fix for #1052 - ViewComponents should support fully qualified names
This change adds the concept of a full-name to viewcomponents. View
components can be invoked using either the short name or long name. If the
provided string contains a '.' character, then it will be compared against
full names, otherwise it will be matched against short names only.

The short name is used for view lookups.

If the name is explicitly set via ViewComponent attribute, then the full
name is the name provided. The short name is the portion of the name after
the last '.'. If there are no dots, then the short name and full name are
the same.

If the name is not set explicitly, then it is inferred from the Type and
namespace name. The short name is the Type name, minus the 'ViewComponent'
suffix (if present). The full name is the namespace of the defining class,
plus the short name.
2014-10-29 17:34:01 -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 26cd8df577 Adding functional tests to verify round tripping of names generated by
HtmlHelpers
2014-10-23 10:12:02 -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