Commit Graph

1072 Commits

Author SHA1 Message Date
Ryan Nowak 8ce069f56a [Fixes #393] [Design] Update ViewComponent result apis to be consistent with Controller
1. Updated ViewComponent to exposes similar properties to the existing ones in controller where
appropiate. We've left out Resolver for being a bad pattern (just inject the dependency on the constructor
or use Context.RequestServices to access it if needed) and Response as although available through the Context
property, it shouldn't be used/modified in a ViewComponent.

2. Updated ViewViewComponentResult to follow a similar pattern as ViewResult where the constructor is
parameterless and elements like ViewEngine are resolved during execution if the user does not set the
associated property on the object.

3. Updated ExecuteAsync in JsonViewComponentResult to remove the unnecessary pragma and async keyword from the
signature and to use Task.FromResult(true) instead.

4. Cleaned up ViewViewComponentResult tests.
2014-11-26 15:56:06 -08:00
Harsh Gupta d2aff42e25 Adding FromServicesAttribute. 2014-11-26 15:35:08 -08:00
Ryan Nowak ff3282827a Fix a test based on the resolution of #1609
This old test (from WSR) was commented out pending the resolution of
issue #1609.

I've updated the test to track the current semantics.
2014-11-26 11:48:01 -08:00
Yishai Galatzer 2eef4dd3cf Remove ControllerDescriptor and fix ControllerActionDescriptor to pick the right type for the display name. 2014-11-25 13:54:57 -08:00
Yishai Galatzer de50d3dbf9 Move MvcOptions to the root folder (reviewed by @pranavkm) 2014-11-25 12:12:47 -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
Hao Kung 27432d9453 React to GetDefaultServices/TryAdd changes 2014-11-24 16:38:45 -08:00
N. Taylor Mullen e7941b5a84 React to aspnet/Razor#210 changes.
- Added the ErrorSink pass through values for our overridden classes.
2014-11-24 11:16:27 -08:00
Doug Bunting a42fa3c800 Touch up tag helper sample
- provide list of users on Index page
 - currently uses only the `<a/>` helper but left `<label/>` and `<input/>` comments
- get date picker working on Create and Edit pages
 - add `[DataType]` annotation
 - use format browsers recognize

nits:
- move "Create New" link to the bottom of `~/Home/Index`
- correct code comment about assigning to a `ViewBag` property
2014-11-22 11:42:17 -08:00
Doug Bunting 823229279a Extend MVC Sample functional test to include all Home views 2014-11-22 10:36:46 -08:00
Doug Bunting ab8a77bb70 Avoid NREs in MVC sample
- see e.g. results of `GET ~/Home/Post`
- use parentheses to avoid `?` confusing Razor

nit: remove unused Home/Test.cshtml view
2014-11-22 10:36:39 -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
Pranav K ba1d66d683 Fixing build break 2014-11-21 09:40:02 -08:00
Pranav K 0e4ec38efe Replacing Assert.Equal(null, Assert.Equal(true \ false etc with
appropriate Xunit equivalents
2014-11-21 08:28:55 -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
Hao Kung eedb08d75d Fix build break 2014-11-20 18:01:50 -08:00
Hao Kung 781bdce0eb Add IServiceManifest 2014-11-20 17:54:10 -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
Ajay Bhargav Baaskaran 90098411c6 [Fixes issue #1528] default reference assemblies made extensible
- Made ReferenceAssemblies and GetCandidateLibraries virtual
- Added relevant tests
2014-11-20 17:20:27 -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
Kirthi Krishnamraju 678226a6bf Merge branch 'Fix298' into dev 2014-11-20 15:49:03 -08:00
Kirthi Krishnamraju a0629f4d23 Fix #298 - Added ModelMetadata.Container property and unit tests. 2014-11-20 15:45:02 -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
Pranav K 8a668eb9d1 Adding unit tests for HtmlHelper.Password
Partial fix for #453
2014-11-20 12:12:29 -08:00
N. Taylor Mullen 35982b3049 React to aspnet/Razor#210 changes. 2014-11-20 11:54:18 -08:00
Ryan Nowak 1563700feb Fix for #1539 - We're not going to do anything special when request
services aren't enabled

This is just removing the TODO.
2014-11-20 11:14:01 -08:00
N. Taylor Mullen 9c4d5dcf5c React to aspnet/Razor#214 mvchook changes. 2014-11-20 10:45:37 -08:00
NTaylorMullen 1cf6607e75 React to aspnet/Razor#214 changes.
- TagHelperAttributeDescriptors changed to be lighterweight and not depend on PropertyInfo, had to modify our use of them to work with the new contract.
2014-11-20 10:27:33 -08:00
Doug Bunting 10f7234c61 Add more tests of `<input/>` tag helper
- scenarios where helper takes different code paths were not well-explored

nits:
- improve a few comments and names
- refactor some setup code into helper methods
- use `EmptyModelMetadataProvider`, not `DataAnnotationsModelMetadataProvider`

Test gap around `GenerateTextBox()`'s `format` argument is temporary.
2014-11-19 22:36:48 -08:00
Doug Bunting 6c4b1398b8 Address small `InputTagHelper` bug discovered while testing
- Type attribute value was "Type", not "type", when determined from template hints

nit: remove useless condition
2014-11-19 22:36:41 -08:00
Doug Bunting 1b28e19114 MVC tag helpers should not override tag name in Razor source
- #1523
- remove `TagHelperOutput.Merge()` extension method entirely
- test tag name preservation with all MVC tag helpers
 - `<input/>` tag helper generation of a checkbox wasn't previously tested

nits:
- fix argument order in a couple of `Assert.Equal()` calls
- remove use of "original tag name"
2014-11-19 22:35:31 -08:00
Ryan Nowak 99a1848598 Checkin VS modifications to kproj
My up-to-date VS wants these projects to have port numbers. Makes sense
because they are web projects.
2014-11-19 16:11:46 -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
Ajay Bhargav Baaskaran e21f157095 changed contract.assert to debug.assert 2014-11-19 15:35:28 -08:00
ianhong f470fa6d74 Merge branch 'actionmodel1495c' into dev 2014-11-18 16:59:01 -08:00
Pranav K a322588af6 Reacting to DataProtectionServices being removed from hosting services 2014-11-18 15:49:12 -08:00
ianhong 59b7352e8e Update per comment 2014-11-18 15:35:40 -08:00
ianhong 7b58d569eb ReadOnly attributes for Action, Controller, and Parameter 2014-11-18 15:35:39 -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
Ryan Nowak 5fd453f07d Revert "Fix for MVC #1539 - Deal with the case where request services are not set"
This reverts commit d9a3c265ea.

This was the wrong commit, did not intent to merge this.
2014-11-17 18:33:56 -08:00
Ryan Nowak d9a3c265ea Fix for MVC #1539 - Deal with the case where request services are not set
Rather than throwing here, this does what routing does. If request
services aren't set, we just create our own scope.

This will NOT create an extra scope if request services are already set.
2014-11-17 17:30:41 -08:00
ianhong 57d234bd7b Removing a <inheritdoc> comment that I forgot from the previous push. 2014-11-14 15:22:36 -08:00
Pranav K 052ad3e95f RenderSection \ RenderSectionAsync does not work in sections
Fixes #1509
2014-11-14 12:17:25 -08:00
ianhong dd1500dcfb Updated a comment and sort usings 2014-11-13 11:28:13 -08:00