Commit Graph

894 Commits

Author SHA1 Message Date
Pranav K 933f7eeb22 Layout specification and discovery should follow the same behavior as
partials

Fixes #1047
2014-12-03 11:54:46 -08:00
Pranav K 765f113515 Checkin VS auto-modifications to kproj files 2014-12-03 11:11:43 -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 b54c326ee6 Updating Associated Metadata Provider to follow the existing pattern. 2014-11-26 16:56:32 -08:00
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
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
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
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
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 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
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
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
ianhong 245d1dffda Updating the summary comment for IRazorViewFactory and its tests per comments 2014-11-13 11:28:12 -08:00
ianhong 0720177243 Updating per comments 2014-11-13 11:28:12 -08:00
ianhong 23a7aa813d Updating FindView_UsesViewLocationExpandersToLocateViews for IRazorViewFactory. 2014-11-13 11:28:12 -08:00
ianhong e9c7a34cfc Introducing RazorViewFactory for RazorView 2014-11-13 11:28:11 -08:00
Doug Bunting 7e8870cb9f Per PR discussion
- clean up "the the" in XML comments
- simplify refactoring VS did when I renamed `GetHtmlHelperForViewData()`
 - fix existing issue in `HtmlHelperCheckboxTest.CheckBoxReplacesUnderscoresInHtmlAttributesWithDashes()`
   (was using a `HtmlHelper<ViewDataDictionary<TestModel>>`)
2014-11-12 21:56:11 -08:00
Doug Bunting 1d3ae83507 Address PR comments in test code
- add missing license headers
- make "post" more obvious
- use `Assert.IsAssignableFrom()`

nit: remove unused `using`s in `HtmlHelperLinkGenerationTest`
2014-11-12 21:56:03 -08:00
Doug Bunting 2982c72547 Add `Html.BeginForm()` and `Html.BeginRouteForm()` tests
- helps w/ #453 since `Html.BeginForm()` wasn't previously tested
- provide a `DefaultTemplatesUtilities.GetHtmlHelper()` overload with an
  `IHtmlGenerator` parameter
- update `DefaultTemplateUtilities` to use `DefaultHttpContext`
 - stop using a mock for this purpose; provides a non-`null` `Request`

nit:
- `DefaultTemplatesUtilities.GetHtmlHelperForViewData()` -> `...GetHtmlHelper()`
  for consistency with other overloads
2014-11-12 21:55:48 -08:00
Doug Bunting 22fafe298c Add `BeginRouteForm()` HTML helper
- refactor `DefaultHtmlGenerator.GenerateForm()` to support new method

nits:
- correct XML comments
- add a few more code comments
2014-11-12 21:55:40 -08:00
kanchanm 4598505652 Fix to special case Dispose method to be treated as non-action 2014-11-12 14:52:19 -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
Doug Bunting 2d32420f01 Add `<option/>` tag helper
- #1423
2014-11-07 14:11:12 -08:00
Doug Bunting 30f25fec99 Provide selected values to `<option/>` tag helpers
- value may remain in the `FormContext` beyond `</select>` end tag but will
  be cleaned up at the `</form>` end tag of the containing `<form/>` element
 - `SelectTagHelper` called prior to helpers for contained `<option/>`s and
   not again later
- adjust mock setups to handle new `GenerateSelect()` call
- add assertions for expected `FormContext.FormData` entry

nit: mention #1468 in a test comment
2014-11-07 14:11:07 -08:00
N. Taylor Mullen de9a999bf6 React to aspnet/Razor#208 changes. 2014-11-07 11:54:30 -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 e37f1ad85f Fix #1502 - Remove duplicate unit tests 2014-11-04 13:30:15 -08:00
Doug Bunting 90e41b905a Add `ModelMetadata.HtmlEncode` property
- use new `ModelMetadata.HtmlEncode` property in HTML helpers
 - specifically in default HTML display and editor object templates (e.g.
   `@Html.DisplayFor()`) when value is non-`null` and the template is invoked
   with template depth greater than 1
- similar to MVC 5.2 commit [2b12791aee4f](https://aspnetwebstack.codeplex.com/SourceControl/changeset/2b12791aee4ffc56c7928b623bb45ee425813021)

nits:
- remove dupe `null` check in `DefaultDisplayTemplates.ObjectTemplate()`
- move backing fields initialized with constants together in `ModelMetadata`
2014-11-03 12:23:33 -08:00
Pranav K d5515bfbb6 Adding arg null or empty checks to RazorViewEngine.FindView &
FindPartialView
2014-11-02 18:33:56 -08:00
Pranav K 74da350086 Remove enableInstrumentation from CompilerCache and IMvcRazorHost 2014-11-02 18:15:39 -08:00
Ryan Nowak b8645eeb31 Follow up to JsonResult changes
Changing the WebAPI shim to use the new and improved JsonResult.
2014-10-31 18:33:15 -07:00
Ryan Nowak 0ccfcc4316 Fix for breaking API change from routing 2014-10-31 18:23:19 -07: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
Doug Bunting 5420b9d382 More `ViewDataDictionary` tests
- separate and extend `ViewDataDictionary<TModel>` tests
2014-10-29 19:19:09 -07:00
Doug Bunting c89bca5924 Adjust tests to handle new `ViewDataDictionary` invariants
- ensure `ViewDataDictionary` constructors are not passed a `null` or
  `Mock.Of<IModelMetadataProvider>()` instance
 - `ViewDataDictionary` constructors always use the `IModelMetadataProvider`
- `viewData.ModelMetadata` now never `null`
- `ViewDataDictionary<int>.Model` no longer throws if read before it's written
- `ViewDataDictionary.ModelMetadata` now copied to new instances in fewer cases
 - e.g. don't use unusual `object` datatype with customized `ModelMetadata`
2014-10-29 19:18:59 -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
Ryan Nowak 305dd87b9b Fix for #1442 - Find better names for ApiExplorerProperties
Taking the suggestion here to move these to a sub-object. This is future
proof in the event that we need to capture more data for ApiExplorer, and
reads better.
2014-10-28 13:03:19 -07:00
Ryan Nowak 46897037e9 TODO removal part 1 - ActionExecutorTests 2014-10-28 12:54:14 -07:00
Ryan Nowak 9a77c2bc1e Fix for #1448 - ViewComponents must be public top-level classes
ViewComponents and Controllers now follow the same rules exactly for what
types of classes they can be.

Also corrected a bug in a test for controllers. Closed-generic types can
be controllers, the test was wrong.
2014-10-28 12:36:07 -07:00
Pranav K 6c4462a76f * Porting Hidden and HiddenFor unit tests
Partial fix to #453
2014-10-27 17:54:56 -07:00
Doug Bunting 1f670bf3a7 Merge branch 'release' into dev 2014-10-27 16:43:02 -07:00
Doug Bunting cfcb1f2e2f Add more unit tests of `ViewDataDictionary` copy constructors 2014-10-27 16:26:04 -07:00
Pranav K e0116bab30 Modifying ArgumentNullOrEmpty message to be consistent with Mvc 5 \
testing code.
2014-10-27 15:07:53 -07:00
N. Taylor Mullen 7934c432c8 React to case insensitive TagHelperOutput.Attributes.
- Cleaned up some existing bad code that worked around case sensitive TagHelperOutput.Attributes.
- Modified MergeAttributes to be case insensitive when it comes to merging class attributes.
- Added a test to verify the new MergeAttribute case insensitive class merging.

aspnet/Razor#186
2014-10-26 13:32:11 -07:00
N. Taylor Mullen 09af7bb77b Change TagBuilder Attributes and HTML Helper dependencies to be case insensitive.
- This involved adding the StringComparer.OrdinalIgnoreCase comparer to the TagBuilder's Attributes dictionary.
- Added tests to validate that all methods that made use of TagBuilder.Attributes abide by the new ignore case mechanic.
- Added two sets of tests to validate the new functionality of Object => Dictionary HTML helper tests.
- Modified a functional test that utilizes HTML Helpers to provide same attribute-different case objects.
- Fixed existing HTML helper tests to account for new ordering of attrbutes (dictionary no longer adds key value pairs, it sets them).

#1328
2014-10-26 13:15:09 -07:00
Ryan Nowak 0a3ad09466 Rename GlobalModel -> ApplicationModel
This also comes with a rename of the namespace
Microsoft.AspNet.Mvc.ApplicationModel to
Microsoft.AspNet.Mvc.ApplicationModels.

Also tuned up some parameter and variable names for increased
understandability.
2014-10-23 16:03:55 -07:00
Ryan Nowak 7ae5e66ccd Refactoring the ControllerActionDescriptorProvider 2014-10-23 12:25:25 -07:00
Pranav K 756f8be49c CompositeValueProvider.GetKeysFromPrefixAsync throws null if provider is not an
IEnumerableValueProvider

Fixes #1419
2014-10-23 11:05:06 -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
Pranav K 78bda87730 Replacing ViewResultBase with ViewExecutor 2014-10-22 08:47:22 -07:00
Pranav K 79ad19f8bd Porting CheckBox and CheckBoxFor unit tests
Partial fix to #453
2014-10-20 11:12:10 -07:00
Doug Bunting d31e107619 Add `SelectTagHelper` tests 2014-10-19 22:29:50 -07:00
Ryan Nowak 557974b948 Removing BodyParameterInfo and ParameterBindingInfo
These have been superceded by the BinderMetadata property on
ParameterDescriptor.
2014-10-17 20:47:20 -07:00
Ryan Nowak 61f218c8e4 Renaming IBinderMarker and friends to some more descriptive names. 2014-10-17 20:32:03 -07:00
Harsh Gupta d1c0213a10 Adding PropertyFilter instead of depending on model metadata to concatenate Metadata for parameter/property and type metadata 2014-10-17 20:07:33 -07:00
Ryan Nowak 77c4391e47 Fix for #1401 - Change namespace of HttpResponseException 2014-10-17 18:43:06 -07:00
Pranav K bd82e584f0 Porting over unit tests for ViewDataDictionary.Eval
Partial fix for #453
2014-10-17 17:27:05 -07:00
Ryan Nowak df8f84b772 Fix #1287 - Port WebAPI parameter binding behavior
This change modifies the default parameter binding behavior for an
ApiController to use the WebAPI rules.

'simple types' default to use route data or query string
'complex types' default to use the body (formatters)

Adds ModelBindingAttribute to enabled model binding
2014-10-17 16:51:48 -07:00
sornaks 5b1bcb6079 Issue #1214: Cannot pass a int parameter to the views from ViewComponent.
Fix: Checking if the model is not null in the Copy constructor of ViewDataDictionary.
2014-10-17 16:40:25 -07:00
Harsh Gupta 75405e3b76 Adding support for bind attribute. 2014-10-17 16:24:28 -07:00
Doug Bunting dd5da33a62 Sanitize "id" attributes for HTML 4.0.1
- #704 part 2 of 2
- change `@Html.Id()` to sanitize return value; was identical to `@Html.Name()`

Copied `TagBuilder.CreateSanitizedId()` and `TagBuilder.Html401IdUtil` from MVC 5.2
- except this `CreateSanitizedId()` returns a valid identifier if first `char` is not a letter
 - e.g. "[0].Name"

nits:
- expand variable names, use lots of `var`, put `public` members first
- add doc comments for `CreateSanitizedId()`

Note users will be able to apply different sanitization once we fix #1188.
2014-10-17 16:12:45 -07:00
jacalvar 98d749d03c [Fixes #1389] Can't bind complex type data from route parameters.
Changed DictionaryBasedValueProvider to do a prefix check instead of just checking if the underlying
dictionary contains the key.
2014-10-17 15:32:21 -07:00
Pranav K 66f626b828 Remove unnecessary references from project.json 2014-10-17 14:26:58 -07:00
Pranav K 5119d16b64 ViewComponent.Invoke() should be able to invoke views
Fixes #285
2014-10-17 12:23:18 -07:00
Pranav K b8d30f29c6 Add IsPartial property to IRazorPage
Fixes #1002
2014-10-17 10:52:39 -07:00
Doug Bunting 012e03e5d0 Add `InputTagHelper`
- also make `TagHelperOutputExtensions.MergeAttributes()` case-insensitive

nits:
- deliniate attribute names in all resource strings
- update validation messages in TagHelperSample.Web
2014-10-16 23:34:10 -07:00
N. Taylor Mullen f8f08f0903 Fix tests and changed TagHelper activates property accessors.
- Changed TagHelper property accessors from private to protected internal.
- Changed throw tests to be shorter.
- Changed reflection setting to now use the internal accessibility of the TagHelpers
- Removed activator to just use internal accessibility of TagHelpers.
- Changed new StringWriter() instances where we didn't need the StringWriter to be TextWriter.Null
2014-10-16 22:39:44 -07:00
N. Taylor Mullen f8b0249918 Add Label TagHelper.
- Validated label TagHelper functionality.

#1249
2014-10-16 21:13:08 -07:00
NTaylorMullen 9c07055ac7 Add ValidationSummaryTagHelper.
- Tested ValidationSummaryTagHelper behavior.
- Updated sample to utilize new ValidationSummaryTagHelper format.

#1251
2014-10-16 21:13:05 -07:00
NTaylorMullen 2729cdc9b7 Add ValidationMessageTagHelper.
- Added tests to validate ValidationMessageTagHelper functionality.

#1250
2014-10-16 21:12:53 -07:00
NTaylorMullen 57d1c542db Add AnchorTagHelper.
- Added a TagHelper that targets the <a> tag and allows users to do the equivalent of Html.ActionLink or Html.RouteLink.
- Added tests to validate AnchorTagHelper functionality.

#1247
2014-10-16 21:12:49 -07:00
N. Taylor Mullen 4c98c8fcb9 Add FormTagHelper.
- Added the FormTagHelper.
- Utilized the IHtmlGenerator to share base functionality with the HTMLHelper counterparts.
- Added tests to validate FormTagHelper functionality.

#1246
2014-10-16 21:12:46 -07:00
N. Taylor Mullen 63f8f7de6d Add extensions for TagHelperOutput to copy and merge from TagBuilder.
- Added tests to validate functionality of all TagHelperOutputExtension methods.

#1319
2014-10-16 21:12:42 -07:00
NTaylorMullen 20cc294c70 Reacted to options and hosting changes after rebase. 2014-10-16 21:12:38 -07:00
Doug Bunting 3b7b0f867d Update `HtmlHelper` to use `IHtmlGenerator`
- make a few more methods available as `internal static` in `DefaultHtmlGenerator`
 - remove `IHtmlGenerator.GenerateOption()`; now `internal static`

nits:
- add `IHtmlGenerator.IdAttributeDotReplacement`
- move `DefaultHtmlGenerator.IdAttributeDotReplacement` after constructor
- move `HtmlHelper.ActionLink()` below static methods
- move newly-`internal` methods together in `DefaultHtmlGenerator`
- correct placement of `DefaultHtmlGenerator.GetValidationAttributes()` comment
2014-10-16 21:12:34 -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
Ryan Nowak 9fadcf74ca Fix for item #1278 - Add WebAPI ActionResult types and helper methods on
ApiController

Ports all of the WebAPI action result types.
2014-10-16 19:33:49 -07:00
jacalvar 8966680075 [Fixes #1332] Port IContentNegotiator to WebAPI shim for CoreCLR support
1. Ported IContentNegotiator.
2. Enabled Core CLR configuration
2014-10-16 17:22:47 -07:00
sornaks 53379e4395 Issue #1206 - DefaultBodyModelValidator throws if get accessor throws.
Fix: The MvcOptions takes in a list of ExcludeFromValidationDelegate (Func<Type,bool>). This func verifies if the type is excluded in validation or not.
2014-10-16 16:09:30 -07:00
Doug Bunting 34f17db94c Add `DefaultEditorTemplates.MultilineTemplate`
- #965
- test call-throughs from `Html.Editor[For]()` to inner `IHtmlHelper`
 - add another parameter to `DefaultTemplatesUtilities.GetHtmlHelper()`

nit: reorder dictionaries at the top of `TemplateRenderer` slightly
2014-10-16 15:14:12 -07:00
Stephen Halter a21ed4bc51 Replace calls to GetService<T> with GetRequiredService<T>
Even though GetService<T> still exists, GetRequiredService<T> preserves
the old behavior of throwing for missing services.
2014-10-16 14:51:41 -07:00
Stephen Halter 54ac14fa0f IServiceProvider.GetService now returns null for missing services
Previously GetService would throw if the requested service was missing.
This commit updates MVC to account for the change in behavior.
2014-10-16 14:51:34 -07:00
jacalvar f8035d6b04 [Fixes #1201] Handle virtual paths in FilePathResult 2014-10-16 13:05:55 -07:00
Harsh Gupta 8f933b2ac3 [Fixefor #860]- Adding Support for [FromFormData] [FromQuery] and [FromRoute],
also updates FromBody to use the new pattern for model binding.
2014-10-16 10:20:15 -07:00
Pranav K b2a01e7b45 Adding support for inheriting tag helpers from _ViewStart files
Fixes #1166
2014-10-16 07:55:37 -07:00
Pranav K 0ad959e236 DateTimeOffset doesn't have a TypeConverter in Mono 2014-10-16 07:10:35 -07:00
Kiran Challa acb2a99e9f [Fixes #1283] Add functional tests for WebAPI-style controllers returning HttpContent 2014-10-16 01:52:33 -07:00
Pranav K 75c6327b2e Layout property needs to be propogated between nested view starts
Fixes #1364
2014-10-15 18:54:02 -07:00
Pranav K de77c92a0a Reviving PartialViewResult and associated methods on Controller
Fixes #824
2014-10-15 18:28:08 -07:00
Ryan Nowak 7666d5973f fix build issue in coreclr 2014-10-15 17:32:06 -07:00
Ryan Nowak 5f47546d40 Use DefaultOrder in MvcOptionsSetup 2014-10-15 17:12:52 -07:00
Pranav K 44d888c319 ViewStartUtility should not return current path if current is a view start
file
2014-10-15 15:05:27 -07:00
sornaks 2c4b3dd3fc Issue #937: Adding functional tests for Filters. 2014-10-15 14:24:53 -07:00
Kiran Challa e985c22528 [Fixes #1216] Provide a property on JsonOutputFormatter to set serializer settings
[Fixes #1221] Rename OutputFormatter's WriteResponseContentHeaders to WriteResponseHeaders
[Fixes #932] Setting Json Serializer Settings
2014-10-15 09:27:09 -07:00
Harsh Gupta ebf64ce4e3 Adding HttpResponseException to WebApi Shim. 2014-10-15 09:07:40 -07:00
Hao Kung 448ac5a0dc React to options and hosting changes 2014-10-14 19:20:28 -07:00
jacalvar 1680616fe5 [Issue #1133] RedirectToActionResult and UrlHelper should use HostString, PathString, etc. To build Urls.
Added tests to describe the current behaviour with Unicode hosts.
2014-10-14 16:12:29 -07:00
sornaks 5fa8a91111 -Issue #913 - Model-binding is being case-sensitive when binding Url data to Enum parameter.
Fix: Using TypeConverter solves this problem.
-Issue #1123 - TypeConverterModelBinder cannot bind "byte" and "short".
Fix: Modified code to use TypeConverter which can handle these scenarios.
-Removing the GetConverterDelegate method and making the code similar to the WebApi.
2014-10-14 15:36:52 -07:00
Pranav K a41b9dc983 Add Html.Partial - sync versions of Html.PartialAsync
Fixes #1107
2014-10-14 15:15:50 -07:00
Pranav K d9ebb37906 Removing Microsoft.AspNet.Mvc dependency from ModelBinding 2014-10-14 12:22:29 -07:00
SonjaKhan 0f5bbdf417 updating ILogger, see aspnet/Logging#3 2014-10-14 10:25:01 -07:00
Kiran Challa dd587f743b [Fixes #1331] Dispose HttpResponseMessage once its written out in HttpResponseMessageOutputFormatter 2014-10-13 22:34:36 -07:00
Pranav K 4ec6da1ed3 Adding RenderSectionAsync to RazorPage
Fixes #845
2014-10-13 17:44:49 -07:00
jacalvar 39376617cc [Fixes #809] Multiple [Http*] verbs should create multiple actions 2014-10-13 15:25:53 -07:00
jacalvar 3f54492930 [Fixes #885] API Explorer: Link Generation
1) Expose the simplified relative path template by cleaning up constraints, optional and catch all tokens from the template.
2) Expose the parameters on the route template as API parameters.
3) Combine parameters from the route and the action descriptor when the parameter doesn't come from the body. #886 will refine this.
4) Expose optionality and constraints for path parameters. Open question: Should we explicitly expose IsCatchAll?
2014-10-13 15:20:38 -07:00
Pranav K a633ef4f97 Modify Razor components to use RazorViewEngineOptions.FileSystem
Fixes #1302
2014-10-13 14:34:31 -07:00
YishaiGalatzer 4166c8cbc9 Fix unit test 2014-10-13 10:13:32 -07:00
Pranav K d912f6cd39 Removing unused types
Fixes #1344
2014-10-13 05:15:26 -07:00
Pranav K 18e11f546d DecorateWriter does not get called for partial views rendered via
Html.PartialAsync

* Introducing StringCollectionTextWriter to buffer the contents of
  PartialAsync
* Ensure DecorateWriter is called for partial views

Fixes #1266
2014-10-12 14:24:29 -07:00
Pranav K 20eadb94ee Remove instrumentation from public API surface
Fixes #1262
2014-10-12 12:57:04 -07:00
YishaiGalatzer 75084ba0cd Move caching of compilation results to its own layer.
This will allow only creating the razor compilation when really needed, with the right lifetime.
2014-10-11 15:35:11 -07:00
YishaiGalatzer 13ee27c92c Rename IControllerAssemblyProvider to IAssemblyProvider and follow through resultant renames 2014-10-11 13:26:07 -07:00
Ryan Nowak 9ad3d5e68f Separate ApiControllers from MVC Controllers in routing 2014-10-10 13:42:12 -07:00
Ryan Nowak 3968df90e4 Fix issue #1282 - Add Request.CreateResponse extension methods
Adds the set of CreateResponse/CreateErrorResponse extension methods that
return an HttpResponseMessage.

For the overloads that perform content negotiation they will access the
collection of MediaTypeFormatters through the shim options. Note that
CreateResponse and friends use the OLD formatters.

Also, HttpError and CreateErrorResponse assume ErrorDetail == false. Using
the shim you will not get detailed error messages unless you construct the
HttpError instance yourself.
2014-10-10 13:42:09 -07:00
Harsh Gupta 5a83383179 Adding ApiController.Validate : Fixes #1286 2014-10-10 13:42:06 -07:00
Ryan Nowak 22869b41c0 Fix issue #1280 - Add HttpResponseMessageFormatter
Adds a formatter that can convert an HttpResponseMessage returned from an
action into HttpContext.Response output.
2014-10-10 13:42:02 -07:00
Ryan Nowak aad3ae42ca Fix for issue #1281 - Add ModelBinder for HttpRequestMessage
This change adds a ModelBinder that can bind an HttpRequestMessage to an
action parameter.

This builds on an earlier change to construct and store the request
message in the HttpContext via an http feature.
2014-10-10 13:41:59 -07:00
Ryan Nowak e51e0e1d52 Fix for issue #1279 - Add .Request property to ApiController
This change adds a .Request property to the ApiController class that can
be used to access an HttpRequestMessage wrapping the HttpContext.

The HttpRequestMessage is stored in an http feature to make it accessible
to model binders and other infrastructure.
2014-10-10 13:41:55 -07:00
Ryan Nowak 9b11c1d90f Fix #1276 - Implement WebAPI action conventions and overloading
This change adds ApplicationModel conventions that can enable WebAPI
action conventions (verb mapping) and WebAPI overloading.

The conventions activate when a controller has a marker attribute.
ApiController has this attribute, so any ported code will automatically
opt-in.

Also ported some old tests for action selection to our new functional test
framework.
2014-10-10 13:41:50 -07:00
Ryan Nowak 2578b8107f Fix for #1277 - Add Options/Startup API for WebAPI shim
Adds an options class, as well as a default options setup that will
configure the default set of formatters.

Currently most of what options needs to do is a placeholder, but it later
do things like add ApplicationModelConventions, filters, formatters, model
binders, etc. Those will be added in follow up items.
2014-10-10 13:41:46 -07:00
Ryan Nowak d9fe305802 Fix for #1275 - Adding ApiController
This change includes the basic properties that we're providing for
compatability as well as some functional tests and unit tests that verify
that ApiController can be a controller class.
2014-10-10 13:41:42 -07:00
Ryan Nowak f66345263d Add WebApiCompatShim project structure 2014-10-10 13:41:35 -07:00
Harsh Gupta e319fef5cb Adding CancellationTokenModelBinder. 2014-10-10 12:16:49 -07:00
Pranav K ad208442d8 Updating functional tests to restore CallContextServiceLocator.Locator.Service on test finish 2014-10-10 11:54:00 -07:00
Pranav K b19764d922 Reacting to CLR package versioning changes 2014-10-10 10:34:01 -07:00
YishaiGalatzer 275f63e91f Prevent Roslyn from loading prematurely on cold start 2014-10-09 23:34:02 -07:00
N. Taylor Mullen 75a77e2d01 Add tests to validate attribute value rendering.
- Exposed internals from Mvc.Razor.Host to Mvc.Razor.Test so it can use the MvcRazorHost override that takes the IFileSystem.
- Added end-to-end code generation tests for TagHelpers with ModelExpression properties.

#1241
2014-10-09 22:47:26 -07:00
YishaiGalatzer 80ef37ab0a Add unit tests to controller properties 2014-10-09 18:18:03 -07:00
Pranav K ba6813a418 Support specifying paths starting with ~/ for layout and partial views
Fixes #821
2014-10-09 17:15:09 -07:00
YishaiGalatzer 4baa2910b7 Add compatibility items for controller back from MVC 5 2014-10-09 16:42:39 -07:00
Hao Kung 6fe663951d Update new test to use UsePerRequestServices 2014-10-09 14:26:18 -07:00
Hao Kung b6bd7f5d78 React to UsePerRequestServices 2014-10-09 14:17:04 -07:00
N. Taylor Mullen c87de5a0fc Add TagHelper functional test.
- Added an end-to-end test that verifies all content behaviors, interactions and functionalities of tag helpers.
- Added some common user scenarios to verify that the system works how we expect.

#1116
2014-10-09 13:37:29 -07:00
N. Taylor Mullen b68fae9b8c Removed the TypeActivator from TagHelper creation.
- We now new up TagHelper's, requiring them to have parameterless constructors.
- Added test to validate throwing.
- Removed existing tests that expected the constructor injection behavior.

#1303
2014-10-09 12:48:20 -07:00
NTaylorMullen 3dff1ca410 Add ITagHelperActivator.
- The TagHelperActivator enables dependency injection via properties and allows access to the ViewContext.
- This replaces the ICanHasViewContext mechanism that we had in place before.
- Added tests and fixed up existing to work with new format for providing ViewContext.

#1258
2014-10-09 12:39:57 -07:00
Doug Bunting 3492be3c6c Add copyright notices to new files 2014-10-09 12:39:32 -07:00
Doug Bunting 639a788ed8 Tag Helpers: add `ModelExpression` class to support `Expression<Func<TModel, TValue>>` attributes
- includes new `RazorPage<TModel>.CreateModelExpression<TValue>()` method
- #1240

nit:
- regenerating the resources reordered Microsoft.AspNet.Mvc.Core's Resources.designer.cs
2014-10-09 12:39:19 -07:00
Doug Bunting 9899cb336a Cleanup tabs in project.json files 2014-10-09 12:38:52 -07:00
NTaylorMullen d041249b27 Add CreateTagHelper to RazorPage.
- The CreateTagHelper method is responsible for creating and activating TagHelpers.
- Added the support for requesting the ViewContext.
- Added tests to validate the tag helper creation mechanism.

#1104
2014-10-09 12:38:31 -07:00
N. Taylor Mullen 082512f63c Add writing scopes to RazorPage.
- RazorPage now has the ability to use writing scopes to control where things are written.
- This enables RazorPages to use these writing scopes with TagHelpers.  TagHelpers use them to buffer attributes that have C# contained within them and to also buffer content of TagHelpers whos ContentBehavior is Modify.
- Added RazorPage tests to validate their functionality.

#1102
2014-10-09 12:38:19 -07:00
N. Taylor Mullen 757441777e Use Microsoft.AspNet.Razor.Runtime project. 2014-10-09 12:37:54 -07:00
N. Taylor Mullen 24a12ba103 Use CodeBuilderContext instead of CodeGeneratorContext. 2014-10-09 12:37:38 -07:00
Hao Kung 6dfcfaa7eb React to options changes 2014-10-08 12:56:53 -07:00
Murat Girgin d3ef91ea91 Fixing NRE with logging 2014-10-08 09:47:39 -07:00
YishaiGalatzer fea30a4096 Making action selection logging not throw on 404 2014-10-07 23:32:59 -07:00
YishaiGalatzer ba1884aacb Make wait service not timeout without yelling, and making the timeout longer 2014-10-07 23:04:36 -07:00
YishaiGalatzer 67a30e491f Introduce default order for framework ordered items to be -1000 2014-10-07 21:43:50 -07:00
Ryan Nowak 19fbcdf5a8 Fix for #1271 - Add copy constructors for ApplicationModel types. 2014-10-07 19:40:42 -07:00
sornaks 5b2948dd73 Excluding a test case in Mono + Fixing a test case. Fixing line lengths. Fixing error messages for tests to pass in Mono. 2014-10-07 11:11:55 -07:00
sornaks a88f59fc49 Issue #1176: Renaming ActionDescriptor, ActionDescriptorProvider, ActionInvoker, ActionInvokerProvider, ActionExecutor, ModelBuilder, Tests. Either dropping "Reflected" or changing it to "Controller" depending on the context. 2014-10-06 20:21:55 -07:00
YishaiGalatzer 144a4b5921 Make RouteDataActionConstraint be POCO only 2014-10-06 16:54:41 -07:00
sornaks f1c1549267 Issue #452: Changes to enable validation for objects generated by InputFormatters. UnitTests + FunctionalTests for the same. 2014-10-06 16:29:56 -07:00
Pranav K c0e077dcd4 Updating ConnegWebSite name in tests 2014-10-06 10:41:36 -07:00
Pranav K bf82d87758 * Updating path to functional test file and functional test references to
unblock Mono build
2014-10-06 10:30:26 -07:00
David Fowler 5890b5b254 Fixed up references 2014-10-05 13:24:00 -07:00
jacalvar 8802c831a0 [Fixes #1155] Added functional tests to cover common versioning scenarios. 2014-10-03 19:00:24 -07:00
Ryan Nowak 78a4e78358 Fix for #975 - Implementing IActionConstraint and ActionMethodSelectorAttribute
IActionConstraint follows a provider model similar to filters. The
attributes that go on actions/controllers can be simple metadata markers,
the 'real' constraint is provided by a set of configurable providers. In
general the simplest thing to do is to be both an
IActionConstraintMetadata and IActionConstraint, and then the default
provider will take care of you.

IActionConstraint now has stages based on the Order property. Each group
of constraints with the same Order will run together on the set of
actions. This process is repeated for each value of Order until we run out
of actions or run out of constraints.

The IActionConstraint interface is beefier than the equivalent in legacy
MVC. This is to support cooperative coding between sets of constraints
that know about each other. See the changes in the sample, which implement
webapi-style overloading.
2014-10-03 18:50:01 -07:00
sornaks 0d8a7368d9 Issue #1141 - When Accept header or Accept-Charset header has invalid QualityFactor we throw.
Fix: Imitating the same behavior as it is in WebApi. We ignore the entire header even if one part of it is invalid.
2014-10-03 16:25:51 -07:00
harshgMSFT 572ec0175c Fix for 1071: Output Formatters should be invoked for writing out the response. 2014-10-03 10:54:59 -07:00
Doug Bunting 0d92a829ff Correct minor problem in `CachedDataAnnotationsModelMetadata.ComputeDisplayFormatString()`
- only affects an extreme corner case: user sets `metadata.EditFormatString` then reads
  `metadata.DisplayFormatString`
- an extreme case because `EditFormatString` is normally set only when
  `DisplayFormatString` is set and, if set, it's to the same value
- happened to see this while updating `CachedDataAnnotationsModelMetadata` for this PR

nit: an -> a in an adjacent XML comment in `CachedDataAnnotationsModelMetadata`
2014-10-02 19:13:45 -07:00
Doug Bunting a5600a74a3 Calculate `ModelMetadata.DataTypeName` based on metadata
- helps MVC helpers like `@Html.EditorFor()` select the correct template
- #933

nit: add XML doc for `DataTypeName` in base `ModelMetadata`
2014-10-02 19:13:35 -07:00
Pranav K 12477c9f52 Changes to make EnableInstrumentation conditionally enabled 2014-10-02 17:55:40 -07:00
Pranav K 5d32d224f4 Changes to support PageExecutionContext in Razor
Fixes #1083
2014-10-02 17:55:23 -07:00
jacalvar a2023d35ee [Fixes #429] FileResult
1) Implemented FilePathResult to efficiently return files from disk.
2) Implemented FileStreamResult to return content from a stream.
3) Implemented FileContentResult to return content from a byte array.
2014-10-02 12:50:24 -07:00
Pranav K 2f00fc6121 Modifying test project.json to allow building on Mono 2014-10-02 12:05:03 -07:00
YishaiGalatzer 9de86892a7 Cleanup namespaces and Task.FromResult 2014-10-02 11:49:44 -07:00
Ryan Nowak 414c009b80 Removing Overloading and Automatic verb-mapping
This change removes WebAPI-style method parameter overloading and the
automatic mapping of 'unnamed' actions based on method names. For all
practicaly purposes, this change restores the MVC5 behavior for action
selection.

WebAPI-style overloading will be brought back in the future via a set of
opt-in constructs.
2014-10-01 18:46:48 -07:00
Pranav K fee3b3cc6c Reacting to Razor changes 2014-10-01 17:47:21 -07:00
Pranav K ad8ab4b8fd Adding support for ViewLocationExpanders to allow modifying view locations
without changing the view engine.

Fixes #1039
2014-10-01 16:15:25 -07:00
Ryan Nowak d8995a7767 Fix for #1192 - Support customizing reflected model through attributes
This adds support for attributes which interact with reflected model.
These conventions are applied after all of our built-in constructs so that
you can see and modify the results.
2014-10-01 14:15:34 -07:00
Pranav K 6c49d0b40e Updating SyncAction_WithException to not test for exception message
Skipping PropertyHelper_WorksForStruct on Mono until further
investigation.
2014-10-01 11:53:21 -07:00
Pranav K 7b5a97d04e Updating TokenProviderTests to use GetAuthenticatedIdentity instead of creating GenericIdentity 2014-10-01 11:35:43 -07:00
Pranav K 4b56fe157d Fixing build break 2014-10-01 11:01:11 -07:00
Pranav K ecb16db58e Remove and sort usings and fixing formatting 2014-10-01 10:28:54 -07:00
Pranav K 38e82c0aa5 Updating Microsoft.AspNet.Mvc.Core.Test to work on Mono 2014-10-01 10:05:36 -07:00
Kiran Challa 1c8582d77a [Fixes #1183] Response uses chunked encoding when returning a string 2014-10-01 07:23:11 -07:00
Pranav K 3cd5c17da7 Updating ModelBinding tests to work in Mono 2014-09-30 20:16:21 -07:00
Pranav K f33eec4845 Updating MvcRazorHost to use overload that generates pragma checksum
Fixes #1152
2014-09-30 12:54:15 -07:00
YishaiGalatzer f82516d155 Fix issue https://github.com/aspnet/Mvc/issues/1202 2014-09-30 12:47:03 -07:00
Pranav K 038b8c7f19 Commonizing Razor Host tests 2014-09-30 12:18:21 -07:00
sornaks 3d5f4a2bfd Issue #985: Adding Functional Tests for ViewComponent Activators. 2014-09-30 10:49:30 -07:00
David Fowler 6279229a7c Removed primary ctor usage 2014-09-28 09:20:06 -07:00
Kiran Challa fdeff1188b [Fixes #926] Protocol & Host name ignored when creating action link 2014-09-26 17:20:56 -07:00
Ryan Nowak 3cd6d3e060 Adding Api Explorer 2014-09-25 15:31:51 -07:00
YishaiGalatzer 6600e68fc0 Create a pre compilation module and apis to allow meta programming
to precompile razor pages.

This is limited to sites where the .cshtml are still deployed. It's
current purpose is to speed up startup. Deploying without the razor
files is a separate feature.
2014-09-25 11:26:11 -07:00
Kiran Challa 43c7ddb9b7 Making UrlHelper's methods virtual 2014-09-24 13:01:34 -07:00
David Fowler 71964a813c Renamed configurations to frameworks in project.json 2014-09-24 01:28:18 -07:00
jacalvar f2dab5eaa7 [Fixes #1156] EmptyResult should not set status code (or do anything for that matter) 2014-09-22 14:12:00 -07:00
sornaks 96318dcbc2 Issue #1072: Adding Unit Tests for GetSupportedContentTypes, CanWriteResult and for XmlFormatters with DeclaredType as object. 2014-09-22 11:17:37 -07:00
sornaks 0b1ad4ce35 Removing XmlSerializerInputFormatter from the list of Formatters.
Introducing a functional test for XmlSerializerInputFormatter.
2014-09-22 11:07:05 -07:00
sornaks 4c951cc635 Issue #1081 - XML DataContract Formatter can fail to write when instance type != declaredType.
Adding Functional tests appropriately.
2014-09-19 15:01:49 -07:00
Ryan Nowak 529b17ea70 Fix for codeplex-1120 - Move CreateSerializer out of the base class
This is a small refactor as a precursor for api-explorer work.
2014-09-17 18:07:42 -07:00
Pranav K bc7241d87a Changes to show intellisense for @inject directive 2014-09-17 12:49:56 -07:00
Pranav K 646c0d704d Limit the maximum number of Model errors to a reasonable value.
Fixes #490
2014-09-16 09:57:00 -07:00
harshgMSFT 9befa6e3a2 Fixing af tests which are failing due to hardcoded values of the tokens. 2014-09-15 18:49:55 -07:00
harshgMSFT 0c13563e33 AF Cookie should be reused within the context of same request.
Fixes issue #959
2014-09-15 16:23:45 -07:00
Ryan Nowak 7ed2de297e moving global filters to options 2014-09-15 15:34:45 -07:00
jacalvar 25838cee55 [Fixes #911] RequireHttpsAttribute does not exist in MVC 6
1. GET requests will be redirected to the equivalent HTTPS url.
2. Requests with any other http method will fail with a 400.
2014-09-15 13:07:30 -07:00
David Fowler 70e809a430 Fixed test projects
- Removed bogus reference to configuration
2014-09-15 01:27:27 -07:00
jacalvar 775a780f49 [Fixes #739] Attribute Routing: Multiple routes per-action
1. Support multiple [Http*] attributes on an action.
2. Support multiple [Route] attributes on a controller and on an action.
3. Support creating multiple attribute routes using [AcceptVerbs("...", Route = "...")]
4. Detect attribute routed actions during action discovery and return one action per [Http*],
   [Route] or [AcceptVerbs] attribute found on the method when there is at least one valid attribute route.
5. Merge all the HTTP methods of [Http*] and [AcceptVerbs] attributes in a method during
   action discovery when there are no valid attribute routes defined on the action.
6. Build one action descriptor per controller [Route] + action [Http*], [AcceptVerbs]
   or [Route] combination in an action.
7. Disallow the use of attributes that do not implement IActionHttpMethodProvider and
   IRouteTemplateProvider simultaneously in methods that define attribute routed
   actions and throw an exception during startup.
8. Disallow mixing attribute routed and non attribute routed actions on the same method
   and throw an exception during startup.
2014-09-12 14:43:19 -07:00
harshgMSFT 7a3dc352c9 1. Moving the HttpNotAcceptableOutputFormatter to product code.
2. Renaming the NoContentFormatter to HttpNoContentOutputFormatter.
3. Updating the test to use mock.
2014-09-12 14:14:44 -07:00
harshgMSFT e884a476e9 Responding to comments 2014-09-12 13:56:33 -07:00
harshgMSFT abf27d883f GetSupportedContentTypes to take in declared and runtime type. 2014-09-12 13:56:30 -07:00
harshgMSFT 7448bf2843 Responding to comments 2014-09-12 13:56:22 -07:00
harshgMSFT 33173d3031 Fix for Content negotiation should fallback to the first formatter that can write the type #1033
- Includes functional and unit tests.
2014-09-12 13:56:14 -07:00
Wei Wang 447336b4f3 React to renaming TargetFramework to RuntimeFramework 2014-09-11 11:49:53 -07:00
Chris Ross 85ad1aeb96 Handle IBuilder rename to IApplicationBuilder. 2014-09-10 14:12:08 -07:00
jacalvar cde1a95d49 [Fixes #900] Use [Route(...)] on action methods to specify an attribute route that allows all verbs.
1. Changed attribute usage on RouteAttribute.
2. Added a test on action discovery to ensure that actions with [Route] get discovered as
   attribute routed actions.
3. Added a test on reflected action descriptor provider to ensure that an action with [Route] on
   the controller and [Route] on the action results in an action that allows any Http method.
2014-09-10 10:11:42 -07:00
Wei Wang 44ccea6871 Upgrade Newtonsoft.Json to 6.0.4 version 2014-09-10 08:52:12 -07:00
jacalvar 9345afeed2 [Fixes #731] Add unit tests for ReflectedActionDescriptorProvider
1. Added tests that cover parameters in actions.
2. Added tests that cover building the reflected application model.
3. Added tests that cover attribute routed action constraints and default values.
4. Added tests that cover conventionally routed action constraints and default values.
5. Refactored and cleaned up ReflectedActionDescriptorProvider. All the refactors consist
   of extracting blocks of code to separate methods to better display the flow when building
   the action descriptors.
2014-09-09 14:03:05 -07:00
Pranav K df0b33a378 Updating ViewStartUtility to use IFileSystem.TryGetParentPath 2014-09-05 14:38:11 -07:00
sornaks 28e334d3db Issue #668: Sample should be covered by a basic functional test. 2014-09-04 14:07:46 -07:00
David Fowler 34add2249e Updated to use the new target framework in project.json 2014-09-04 02:02:40 -07:00
jacalvar b6fb7ac7df Take advantage of nameof to improve our usage of MemberData across the code base.
Substituted all instances of [MemberData("PropertyName")] for [MemberData(nameof(PropertyName))]
This change enables us to take advantage of IDE features like Navigate to source,
find all references, etc. When using Visual Studio.
2014-09-02 13:53:03 -07:00
Pranav K b8692c2c21 Updating FunctionalTests to use HttpClient abstractions 2014-09-01 11:16:54 -07:00
jacalvar ccc20a38c1 [Fixes #734] Attribute Routing: Implement Name
1. Added support for Name in attribute routing. Name can be defined using [RouteAttribute]
and the different Http*Attributes, for example [HttpGet].

2. Names defined on actions always override names defined on the controller.

3. Actions with a non empty template don't inherit the name from the controller. The name
   is only inherited from the controller when the action template is null or empty.

4. Multiple attribute routes with different templates and the same name are not allowed.
2014-08-29 17:51:12 -07:00
Pranav K a931e21456 Adding support for flush points in Razor pages
Fixes #1042
2014-08-29 09:30:23 -07:00
David Fowler 2e6e5307f6 Updated to use the new target framework in project.json 2014-08-28 22:14:10 -07:00
YishaiGalatzer e40dbcaebf Prevent flushing when writing out from the formatters.
Also make the XML formatter respect object as a return type.

Issues: MVC/1073, MVC/972, MVC/958

1072 is a followup work item to add test coverage.
2014-08-28 14:15:07 -07:00
Pranav K d604c18368 Moving IModelValidatorProvider to Options
Fixes #879
2014-08-26 11:53:32 -07:00
Pranav K d77b06f742 Fixing IFileSystem in Razor test 2014-08-26 10:30:08 -07:00
Pranav K b2750752dd Reacting to IFileSystemInfo changes 2014-08-26 09:52:52 -07:00
Pranav K 096ba08a8d Reacting to IFileSystemInfo changes 2014-08-26 09:48:19 -07:00
harshgMSFT 313a537ea1 Adding ModelStateError if there is no input formatter selected. 2014-08-22 16:52:58 -07:00
Ryan Nowak 9faca78a84 Optimize attribute routing link generation 2014-08-22 15:28:19 -07:00
Pranav K 2dcbbf70b0 Modifying RazorViewEngine to create IRazorView instances from service
container
2014-08-22 11:41:04 -07:00
Pranav K a490abc6e8 Adding support for inheriting chunks from _ViewStarts as part of host
parsing.

Fixes #881
2014-08-22 11:04:42 -07:00
sornaks 791518d44d Issue #347: Throw a better exception when the user didn't add the MVC services.
Introducing MarkerService for identifying if MvcServices were added.
2014-08-21 13:59:52 -07:00
Pranav K eccd25bedd Change ThrowIfFaulted to WaitAndThrowIfFaulted 2014-08-21 11:55:41 -07:00
Pranav K 9c4df4606f Modify TemplateRenderer to use ThrowIfFaulted instead of Task.Wait
Fixes #782
2014-08-21 08:38:12 -07:00
Chris Ross 76ecb73040 Fix abstractions break in tests. 2014-08-20 14:33:39 -07:00
sornaks b9f1586008 Changes to introduce CanWriteResult for Xml OutputFormatters. 2014-08-20 11:09:09 -07:00
dougbu 041d350d51 Test data/time templates
- focus on affect of `ModelMetadata.HasNonDefaultEditFormat` and
  `IHtmlHelper.Html5DateRenderingMode`
- work through `TemplateRenderer` because individual templates only do
  formatting in a few cases
2014-08-20 10:08:23 -07:00
dougbu 98e23075dd Test `DisplayFormatString`, `EditFormatString`, and `HasNonDefaultEditFormat`
- `DisplayFormatString` and `EditFormatString` now based on attributes
- `HasNonDefaultEditFormat` is new
- confirm `DataType` and `ScaffoldColumn` in `CachedDataAnnotationsMetadataAttributes`
2014-08-20 10:07:55 -07:00
dougbu 0595e9ebc9 Move two recently-added `[HiddenInput]` tests into `CachedDataAnnotationsModelMetadataProviderTest` 2014-08-20 10:07:49 -07:00
dougbu 266644560f Clean up `AssociatedMetadataProviderTest`
- remove unused nested class `ModelWithReadOnlyProperty`
- remove unecessary nested classes `RangeAttribute` and `RequiredAttribute`
- use `Assert.NotEmpty()` and `Assert.Single()` where appropriate
2014-08-19 15:49:06 -07:00
jacalvar 2eec0bbf6d [Fixes #1035] RouteGroupConstraint should only be added once for non attribute routed actions
1. Changed ReflectedActionDescriptorProvider to add RouteGroupConstraint only once
   for non attribute routed actions.

2. Added tests to cover the scenario.
2014-08-19 13:14:56 -07:00
harshgMSFT 6f0fa67170 Enabling basic input formatter selection.
Conflicts:
	Mvc.sln
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs
	src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvokerProvider.cs
	src/Microsoft.AspNet.Mvc/MvcServices.cs
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionInvokerTest.cs

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
2014-08-19 12:46:52 -07:00
Pranav K 764b1e64b8 RoslynCompilationService should set the generated code when compilation is successful
Fixes #895
2014-08-19 09:24:28 -07:00
harshgMSFT 64d797a489 1. Moving input formatting related classes to MVC Core.(for tests as well).
2. Cleaning up the IInputFormatter to the final version.
3. Updating the input formatters and the context to be compliant with the IInputFormatter interface.
4. Adding Functional Tests.
- Not cleaning up TempInputFormatterProvider.

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/InputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/XmlDataContractSerializerInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/XmlSerializerInputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs
	src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/Microsoft.AspNet.Mvc.HeaderValueAbstractions.kproj
	src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.kproj
	src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/FormValueProviderFactory.cs
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
	test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/FormattingUtilities.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/TempInputFormatterProvider.cs
2014-08-18 17:07:19 -07:00
harshgMSFT d97a427b3d Adding Input Formatters to MVC Options and using HeaderValueAbstractions 2014-08-18 10:25:19 -07:00
Louis DeJardin 5de2bc8243 Implementing ILoggerFactory.AddProvider 2014-08-15 16:34:14 -07:00
harshgMSFT bb452f19a7 JsonResult to use ObjectResult for content negotiation to pick default json formatter. 2014-08-15 15:56:24 -07:00
sornaks 2920c55116 Changes to enable XML Output Formatters.
- Unit / Functional tests for the same.
2014-08-15 15:05:00 -07:00
dougbu 1a4bd25e0f Add `[HiddenInput]`, `ModelMetadata.HideSurroundingHtml`, and `.Properties` tests
nits:
- add a few missing default `ModelMetadata` property value checks
- cleanup some redundancies in test data initializers
2014-08-15 12:33:58 -07:00
dougbu 53432e1483 Address TODO item in default `object` editor template
- add validation elements per property in this template
- update editor template test to expect new `<span>` in result
2014-08-15 10:50:20 -07:00
harshgMSFT 3f952c153f Fixing build break due to tests 2014-08-15 10:28:11 -07:00
David Fowler fa6b3acc4a Removed source files from the project 2014-08-15 09:14:49 -07:00
harshgMSFT 1684d1d322 NoContentFormatter: Writes 204 to the response status code if the value returned is null. 2014-08-14 19:16:26 -07:00
Pranav K 538e589894 Modifying ViewDataDictionary and RouteValueDictionary to copy on write
instead of eagerly copying.

Partial fix for #878
2014-08-14 18:18:54 -07:00
Ryan Nowak b72b44c20c Implement RouteKeyHandling.CatchAll 2014-08-14 15:59:09 -07:00
Ryan Nowak 8bfb6eb8d5 implement a decision-tree-based action selector 2014-08-14 15:45:45 -07:00
harshgMSFT 28092d975b Fixing a warning 2014-08-14 14:23:03 -07:00
Ryan Nowak 3770906c3b Issue #862 Extensibility for action invoker 2014-08-14 13:25:52 -07:00
Javier Calvarro Nelson 3ab0c3af29 [Issue #733] Attribute Routing: Implement Order
1. Added an Order property to IRouteTemplateProvider, ReflectedAttributeRouteModel,
   AttributeRouteInfo, AttributeRouteLinkGenerationEntry and AttributeRouteMatchingEntry.

2. Changed the implementation of AttributeRoute to take the order into account when routing
   incomming requests and generating links.

3. Ensured a stable ordering of route entries with the same order and precedence for route
   matching and link generation based on the template text.

4. Added tests to validate that the precedence gets respected in route matching and link generation.

5. Added tests to validate that the order gets respected in route matching and link generation.

6. Added tests to validate that the order gets respected over the precedence for route matching
   and link generation.

7. Added tests to validate that routes with the same order and precedence expose a stable ordering
   for route matching and link generation.
2014-08-14 11:21:05 -07:00
Javier Calvarro Nelson 63d9625536 [Issue #730] Attribute Routing: Flesh out attributes - Part 2
1. Unsealed the Http*Attributes so that they can be extended and customized.
2. Added the same constructors as HttpGet to the rest of the Http*Attributes.
3. Added unit tests to validate the implementations for the IActionHttpMethodProvider.
4. Added functional tests to cover extra attribute routing scenarios like a test for an
   action with an HttpDeleteAttribute on it and action with AcceptVerbsAttribute and an
   action with a custom HttpMergeAttribute implemented.
2014-08-14 11:21:03 -07:00
Javier Calvarro Nelson 21b1174d76 [Issue #730] Attribute Routing: Flesh out attributes - Part 1
1. Added a new AttributeRouteInfo class to store all the information for
   actions that are attribute routed.

2. Added a new ReflectedAttributeRouteModel class to store all the information
   related to attribute routes in the ReflectedApplicationModel.

3. Refactored ReflectedControllerModel and ReflectedActionModel to use ReflectedAttributeRouteModel
   instead of just the attribute route template.

4. Refactored ReflectedActionDescriptorProvider to use AttributeRouteInfo and ReflectedAttributeRouteModel
   instead of just the route template.

5. Added a CombineReflectedAttributeRouteModel method in ReflectedAttributeRouteModel that handles
   combining two ReflectedAttributeRouteModel instances.

6. Removed the AttributeRouteTemplate class and moved the methods for combining attribute routes to the
   ReflectedAttributeRouteModel class.

7. Added unit tests for ReflectedActionModel and  ReflectedControllerModel that
   cover the usage of AttributeRouteInfo.

8. Added unit tests for CombineReflectedAttributeRouteModel.
2014-08-14 11:21:01 -07:00
Pranav K 26f98b481a ViewComponents should render partial views
Fixes #960
2014-08-14 11:14:05 -07:00
Pranav K fb773f4814 ViewEngine shouldn't throw when it doesn't know about the extension
Fixes #984
2014-08-14 10:53:01 -07:00
sornaks 9c4d7806a7 Introducing ByteArrayModelBinder.
-Checks for ModelType before processing.
-Ignores quotes in ByteArrayModelBinder.
-Unit,functional Tests.
-ModelStateError is set when Covert.FromBase64String(value) throws.
2014-08-13 15:15:52 -07:00
harshgMSFT 8d3d15fb4a Adding a functional test for anti forgery. 2014-08-13 15:00:00 -07:00
sornaks e6f4f0fec6 Introducing Activator for ViewComponents. 2014-08-13 14:22:43 -07:00
Pranav K 90b40832ff Modify RazorView to be instantiated via TypeActivator
Partial fix for #889
2014-08-12 10:37:00 -07:00
Pranav K 9e68a163fd Make RazorPage.IUrlHelper a non-public property
* This allows for injection of the property in cshtml files wthout running
in to compilation errors
* Make IUrlHelper a default injected service

Fixes #816
2014-08-12 10:12:23 -07:00
harshgMSFT 6ee034e64f ProducesAttribute +
Adding Functional Tests

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/OutputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Resources.resx
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/project.json
	test/Microsoft.AspNet.Mvc.FunctionalTests/project.json

Adding Resources + tests

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs
	src/Microsoft.AspNet.Mvc.Core/Resources.resx

Adding produces content Attribute

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
2014-08-11 17:52:55 -07:00
Pranav K 74bb8288b0 Making RoslynCompilationService a singleton.
* Minor code cleanup from previous compilation related PR.
2014-08-11 14:36:58 -07:00
Pranav K 758c0cadef Fixing unit test 2014-08-11 10:39:42 -07:00
Pranav K c12a4795ca Removing AdditionalInfo from CompilationResult since we can't always pass
it into exception thrown

All values in Exception.Data need to be serializable which is not true for
the diagnostics. Removing this property since we can't pass it through.
2014-08-11 10:25:12 -07:00
Pranav K 5e010597cd Propogate additional compilation data from RoslynCompilationService
* Update CompilationFailedException to include path of file being compiled
* Pass in path being compiled to Rolsyn.
* Adding doc comments for compilation pieces

Fixes #869
2014-08-08 18:22:13 -07:00
Chris Ross cd3e1da219 Fix Challenge params order. 2014-08-07 16:03:34 -07:00
dougbu 56d66c090e Make HTML helper `null` handling consistent
- #874 lines 3, 4, and 6
- correct `Value()` to treat a `null` expression name the same as `string.Empty`
- add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()`
- consistently pass `null` for default expression names to the helpers
 - for example, from extension methods
- add test cases using `null` for expression name

nits:
- correct summary XML comment for `HtmlHelper` class
- use named parameters and prefer interface (not extension) methods in changed calls
- use `string.Empty` instead of `""` in a few tests
2014-08-06 16:04:56 -07:00
dougbu 8ab11bc073 Correct XML comment syntax
- fix problems at least with Roslyn compiler and VS IntelliSense or the Object Browser
 - `<see langref="keyword"/>` generates nothing
 - `<example>` at top level (outside `<summary>`) generates nothing
 - curly braces don't become angle brackets outside `<see cref="reference"/>` references
  - yeah, a point @yishaigalatzer asked about in a previous PR
- `<see href="reference"/>` is not valid
- correct some invalid use of angle brackets and remove useless empty elements
- correct unresolved XML comment references; generally, add namespace prefix

Symptoms for some of the above issues included
- generated XML comments such as `<!-- Badly formed XML comment ... -->`, usually indicating an unclosed element
- generated XML attributes such as `cref="!:..."`, indicating a broken reference
 - in a couple of cases we had `<typeparamref cref="TOption"/>`; attribute should be `"name"`

Few wording changes beyond
- `"opening </form> tag"` -> `"<form> start tag"`
- `"closing </form> tag"` -> `"</form> end tag"`

Also correct two typos in `HtmlHelper`

Will create a unit test to ensure XML syntax doesn't degrade going forward.  Separate PR.
- for now, check using `dir -r *.xml | sls '!'`
2014-08-05 14:24:48 -07:00
Pranav K 5168808906 Introducing RazorTextWriter
RazorTextWriter represents the result of rendering a page as a sequence of
strings rather than a concatenated string. This avoids building up large
strings in memory.
2014-08-05 10:09:04 -07:00
Pranav K 9d36a45f38 Updating tests using Moq to workaround Roslyn changes
https://roslyn.codeplex.com/workitem/246 affects usage of code with the
latest build of Roslyn with Moq v4.2. The workaround involves ensuring a
closure is created. Updating affected tests to make ToString() calls on
local variables to create these closures.
2014-08-04 17:13:19 -07:00
Ryan Nowak 383c6305e1 Fix for issue #349 2014-08-04 16:49:24 -07:00
dougbu d0d7c6aef8 Add `HtmlHelperDisplayTextTest` and `HtmlHelperValueExtensionsTest` classes 2014-08-01 21:06:28 -07:00
dougbu 126ee116cf Remove useless `.ToString()` calls in tests 2014-08-01 21:06:23 -07:00
Ben Brown 01f5fec210 Added Logging to Mvc 2014-08-01 15:33:47 -07:00
harshgMSFT 19f3f78b3e Adding TextPlainFormatter to always handle returning strings as text\plain format.
Conflicts:
	src/Microsoft.AspNet.Mvc.Common/Encodings.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/JsonOutputFormatter.cs
	src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs
	test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ObjectContentResultTests.cs
	test/Microsoft.AspNet.Mvc.Test/MvcOptionSetupTest.cs
2014-08-01 13:47:23 -07:00
Ryan Nowak 99d053ef81 Return a copy of the route values in functional tests.
This is a workaround for a Json.Net + CoreCLR issue.
2014-07-31 15:09:47 -07:00
harshgMSFT 01260515f1 Responding to comments 2014-07-29 18:25:34 -07:00
harshgMSFT 2fe2efa94a Moving to the latest pattern of Specifying formatters using options 2014-07-29 18:02:10 -07:00
harshgMSFT 307c191c17 Adding support for content negotiation.
This change consists of :
1. Conneg based on request headers, supports the following 3 scenarios:
	a. ContentType property on ObjectResult set to null or is empty.
	b. ContentType property on ObjectResult set to a single content type.
	c. ContentType property on ObjectResult set to multiple content types.

2. Parsing Helpers, comparers and extensions for comparing various http headers.
3. Tests.

Open workitems:
1. Remodel JsonResult and ContentResult to be a derivation of ObjectResult.
2. Populate DeclaredType.

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/OutputFormatterDescriptor.cs
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	src/Microsoft.AspNet.Mvc.Core/OptionDescriptors/OutputFormatterDescriptorExtensions.cs
	src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs
	src/Microsoft.AspNet.Mvc.Core/Resources.resx
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/MediaTypeHeaderValue.cs
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/MediaTypeWithQualityHeaderValue.cs
	src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs
	src/Microsoft.AspNet.Mvc/MvcServices.cs
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/OptionDescriptors/OutputFormatterDescriptorExtensionTest.cs
	test/Microsoft.AspNet.Mvc.HeaderValueAbstractions.Test/MediaTypeHeaderValueParsingTests.cs
	test/Microsoft.AspNet.Mvc.Test/MvcOptionSetupTest.cs
2014-07-29 17:26:56 -07:00
Ryan Nowak 2987f98283 Adding parameter replacement 2014-07-29 16:14:57 -07:00
Ryan Nowak 2f9501458f Add friendly name to action descriptor. Issue 820
Used in error messages for various attribute routing pieces, and anywhere
that you need a display name for an AD.
2014-07-29 15:14:59 -07:00
sornaks cee73c0af3 1. Introducing XML Input Formatters.
2. Adding DelegatingStream class
3. Unit + Functional tests for formatters.
2014-07-29 15:04:23 -07:00
Javier Calvarro Nelson b0d52f73fd [Issue #527] Revive common ActionResults - Part 1.
1. Added HttpNotFound() to Controller.
2. Updated HttpStatusCodeResult to expose the StatusCode as a property.
3. Added unit tests for HttpNotFound() and for HttpStatusCodeResult.
4. Updated the MvcSample to add an action that uses HttpNotFound().
5. Brought back HttpNotFoundResult and added unit tests for it.
2014-07-25 13:04:59 -07:00
Pranav K 24f74222f5 Introducing Controller.TryUpdateModel
This changeset reintroduces some of the overloads for
Controller.TryUpdateModel.

Fixes #415
2014-07-25 10:08:44 -07:00
Pranav K da0bf6f7d8 Commonizing code in option provider
* Adding ValueProviderFactoryProvider and CompositeValueProviderFactory to
  maintain parity in pattern with other option types.

Fixes #818
2014-07-25 06:52:00 -07:00
Pranav K 92e26cf8e0 RazorView should not create new ViewContext when rendering pages.
For pages that can pop back (e.g. Partial pages \ View Components), the
invoking component already creates a new ViewContext. ViewStart, Pages
and Layouts need to share the same Layout. This is required for sharing
ViewData values (such as title).

Fixes #861
2014-07-25 06:37:53 -07:00
dougbu 3746e44dc3 Add more `ModelMetadata` and HTML helper tests
- add `CachedDataAnnotationsMetadataAttributesTest`
- add `CachedDataAnnotationsModelMetadataTest`
- confirm more default property values in `ModelMetadataTest`
- confirm use of `DisplayName` in `ModelMetadataTest`
- add `HtmlHelperDisplayNameExtensionsTest`
- add `HtmlHelperLabelExtensionsTest`
- add `HtmlHelperNameExtensionsTest`
2014-07-24 18:32:35 -07:00
Pranav K 47d227cbf2 Modify FindView and FindPartialView to accept ActionContext
Fixes #787
2014-07-24 11:48:23 -07:00
harshgMSFT a2561281b7 Adding MvcOptions.OutputFormatters property. 2014-07-23 17:46:17 -07:00
harshgMSFT 1df4738a19 Adding OutputFormatter base class 2014-07-23 16:50:22 -07:00
Pranav K e28adbfb3d ViewStarts need to be executed as part of View execution
Fixes #834
2014-07-23 16:45:25 -07:00
harshgMSFT b8ab5c5063 Http Abstractions for parsing Http headers needed for conneg. 2014-07-23 16:28:32 -07:00
Ryan Nowak d13f6474d8 adding a few tests for areas 2014-07-21 14:52:44 -07:00
Ryan Nowak 1b07c89322 cr feedback 2014-07-21 14:52:41 -07:00
Ryan Nowak 745239f09f Adding Attribute Routing Link Generation 2014-07-21 14:52:38 -07:00
Pranav K 340bd7550a Adding RazorView to Microsoft.AspNet.Mvc.Razor
RazorView was part of the previous commit but was separated to make it
easier to see the diff in RazorPage that was formerly named RazorView

Adding IRazorPage and changes per code review comments
2014-07-18 21:14:45 -07:00
Pranav K 9e535f6897 Separating view execution and Razor behavior
* Introducing RazorPage and RazorPageOfT that represent the Razor
  execution aspect of view execution. Moving view execution hierarchy behavior
  (Layout, partial views etc) into a separate RazorView type.

* Renaming IVirtualPathViewFactory to IRazorPageFactory,
  IRazorViewActivator to IRazorPageActivator

* Renaming VirtualPathViewFactor to FileBasedPageFactory to
  correctly reflect what it does.

Fixes #814
2014-07-18 14:58:12 -07:00
Pranav K c1112fcaf1 Move ValueProviders to MvcOptions
Fixes #778
2014-07-17 21:02:47 -07:00
Ryan Nowak bff94f169f Fix for issue #610 - Ignore internal and nested types
This change exludes internal and nested types from being treated as
controllers. This is consistent with MVC5's behavior.

DefaultActionSelectionConventions was primarily tested through running
action selection. I wanted to also test the methods with substantial logic
in this class, so I moved a spate of a classes from private classes inside of the
integration tests to public classes so they could be shared. I also added
tests to fill gaps in DefaultActionSelectionConventions, which is the vast
vast majority of this change.
2014-07-16 16:33:26 -07:00
Pranav K 9f8c656b31 IUrlHelper and IViewComponentHelper need to be activated
* Removing Init method and using [Activate] to activate IUrlHelper.
* Moving IViewComponentHelper to default injected properties
* Adding functional tests to verify these properties are injected \
  activated

Fixes #789
2014-07-16 16:24:03 -07:00
Yishai Galatzer 472e500864 Cache file info access in viewengine
Move compilation and VirtualPathViewFactory to be singletons
And cache access to files.

The cache time is controlled by MVC options.
The cache is implemented in the ExpiringFileInfoCache.cs
2014-07-16 13:12:21 -07:00
Javier Calvarro Nelson 87c430ae19 [#732] Attribute Routing: Implement `~/` for overriding a prefix
This change allows a user to override a route prefix set using
[Route("...")] on the controller by providing a route template
on the action that starts with "~/" or "/". For example,
[HttpGet("~/...")] or [HttpGet("/...")]

If the user specifies a template in [Route] that starts with "~/"
or "/", we will just strip the prefix from the template and use
the remaining part of the template.

The reason to do this is that there's a reasonable extensibility
scenario where a user can implement a global prefix for routes as
a convention (using IReflectedApplicationModelConvention), and use
~/ to escape that prefix (just like we support with action-level routes).
2014-07-16 09:40:38 -07:00
Pranav K bbdb2dfbf2 Adding support for activating view properties
Fixes #700
2014-07-15 16:26:07 -07:00
Pranav K f6106e424e Reacting to System.Collections versioning change 2014-07-14 15:54:00 -07:00
Pranav K 3692cc7d83 Revert "Adding support for activating view properties"
This reverts commit 21bb8cb9fb.
2014-07-14 11:42:41 -07:00
Pranav K 21bb8cb9fb Adding support for activating view properties
Fixes #700
2014-07-14 10:40:07 -07:00
David Fowler 7e7c56ce48 Renamed configurations to frameworks in project.json 2014-07-13 21:58:12 -07:00
sornaks 720923a1a4 Moving UTF8EncodingWithoutBOM.cs to Common and renaming it as Encodings. 2014-07-10 10:47:54 -07:00
David Fowler b1c0792e8c Added Configuration to TestApplicationEnvironment 2014-07-10 10:22:24 -07:00
Pranav K 177aadeadf Add extra unit tests and functional tests for CompositeViewEngine
Fixes #768
2014-07-09 15:03:34 -07:00
Pranav K 23eefed31a Move setting up options to MvcOptionsSetup
Fixes #760
2014-07-09 09:45:17 -07:00
Pranav K 5194adfaf5 Moving IViewEngine to MvcOptions 2014-07-08 17:50:13 -07:00
Ryan Nowak 6c5b836070 Removing magic link generation 2014-07-08 12:17:49 -07:00
Pranav K dbd26ef9a3 Chaning unit test to use Mock.Setup instead of setting it directly 2014-07-08 11:46:47 -07:00
Chris Ross 93869a5d7b Fix test. 2014-07-08 10:40:06 -07:00
Chris Ross 240d969899 Add using statement for extension methods. 2014-07-08 10:19:16 -07:00
Ryan Nowak e396f1b451 Adding attribute routing 2014-07-03 18:53:38 -07:00
Ryan Nowak c17d33154f Fix for #617 - ViewResult can be constructed without a view engine
We want result types to be constructable without services.
2014-06-27 17:05:09 -07:00
dougbu 172a5a5500 Address review comments
- XML comments for changed `TemplateInfo` properties
- correct `DefaultDisplayTemplateTests` and `DefaultEditorTemplateTests` namespaces
- add a couple of low-level `TemplateInfo` tests
2014-06-27 15:56:51 -07:00
dougbu bbf470bd34 Also test `string.Empty` model 2014-06-27 15:56:47 -07:00
dougbu 6eb1e38e33 Add `@Html.Display()` and `@Html.Editor()` tests with values in `ViewData` 2014-06-27 15:56:43 -07:00
dougbu 1a4d59ae14 Enable us to unit test `@Html...For()` methods
- add more `DefaultTemplatesUtilities.GetHtmlHelper()` overloads, all
  returning a strongly-typed helper
- also correct that method to ensure template helpers each get a unique
  `IHtmlHelper` instance
2014-06-27 15:56:35 -07:00
Pranav K e7c2faff32 Unwrap nullable types in PropertyHelper prior to looking up properties
Fixes #721
2014-06-27 15:27:51 -07:00
Pranav K 0f0d44c6b3 Fixing ModelChunkVisitorTest to match resource name
Fixing stylecop issues
2014-06-27 11:55:24 -07:00
N. Taylor Mullen 2ad175b687 Add @model specific tests to validate output.
#568
2014-06-27 11:23:27 -07:00
N. Taylor Mullen 54d6b0b113 Modify tests to use new ModelCodeGenerator.
#568
2014-06-27 11:23:24 -07:00
Pranav K 2aacdeca4a Modify AssociatedMetadataProvider to use PropertyHelper to create accessor
Additionally change it to use TypeExtensions.GetReadableProperties to get
property list. This causes it to ignore indexers which should not be
considered.

Fixes #595
2014-06-27 10:50:37 -07:00
Pranav K 3c092cb083 Moving model binders from DI to MvcOptions 2014-06-26 21:49:46 -07:00
Ryan Nowak ba506b2976 fix build break - this wasnt referencing the right helios package 2014-06-26 14:18:41 -07:00
Ryan Nowak f194723230 Adding tests for convention-based routing 2014-06-26 14:00:42 -07:00
Chris Ross 3aae5cb4fa Fix one more test. 2014-06-26 11:06:26 -07:00
Chris Ross 1d3e6b0dd0 Fix breaks from GetFormAsync, IReadableStringCollection.Keys. 2014-06-26 10:56:56 -07:00
David Fowler e6ec6e0aba React to resource changes 2014-06-25 22:48:32 -07:00
Ryan Nowak 0d7f38e10e Commonize code to limit functional tests to a single site each 2014-06-25 09:00:34 -07:00
dougbu dd2216fa89 Remove K10 configuration from AutofacWebSite 2014-06-24 20:33:21 -07:00
dougbu 23146787dc NET45-ify our Autofac functional test
- see loads of load failures after `kvm.ps1 upgrade -svrc50` otherwise
2014-06-24 19:33:50 -07:00
dougbu 5149c7cd19 Get ModelBinding test project working on K10 again
- restore `ClientRulesWithCompareAttribute_ErrorMessageUsesResourceOverride` since
  DataAnnotations has fixed underlying problem
2014-06-24 19:33:47 -07:00
Pranav K 9bf6982168 Reacting to HttpAbstractions changes 2014-06-24 16:36:36 -07:00
Pranav K 24e1ac7ca1 Revive ModelMetadata.ShowForDisplay and ModelMetadata.ShowForEdit
Fixes #679
2014-06-23 16:50:09 -07:00
N. Taylor Mullen 6cc47cd5f1 Add Autofac functional test.
Added very simple Autofac functional test that validates that we can add custom classes to the DI system as well as just use the ones provided to us.

#669
2014-06-23 16:17:50 -07:00
dougbu 23740085f1 Catch MVC up with Helios rename
- one more file to change on dev branch
2014-06-23 15:46:57 -07:00
dougbu 2bfc3e32e9 Merge branch 'release' into dev 2014-06-23 15:45:03 -07:00
dougbu 0c6749a5e7 Catch MVC up with Helios rename
- allows builds to succeed after cleaning your repo (without NuGet.org source)
2014-06-23 14:05:47 -07:00
sornaks 15b06a4057 Fixing the TODOs dependent on SimpleDisplayText. 2014-06-23 11:55:16 -07:00
Pranav K cca78bb055 Adding support for ActivateAttribute via IControllerActivator
This mechanism replaces code in Inject that activated properties
by looking them up by names.
2014-06-23 11:00:28 -07:00
Tian Pan 4c9f19aafc Update controller methods to be all virtual
Fix #596
2014-06-20 15:40:02 -07:00
Ryan Nowak e6ba1f23a2 refactor of action descriptor pipeline
(cherry picked from commit 634f756e7fd303fc3022563fcd8fb9b1cb47fba2)
2014-06-20 11:11:08 -07:00
Brice Lambson 172dcd179b Bump version to 6.0.0-* 2014-06-19 11:21:43 -07:00
harshgMSFT 08b64a2a4a InlineConstraint Functional Test, removing the dependency on a physical file. 2014-06-18 13:42:33 -07:00
Yishai Galatzer 9e1deb7982 Fixup unit tests to mock RequestServices instead of ApplicationServices 2014-06-18 13:40:58 -07:00
Tian Pan e27742fd0b IsValidActionMethod fails to check static methods.
Fix #638
2014-06-16 18:04:09 -07:00
Pranav K 85bd056780 CreateActionResult should work when action returns Task.
Fixes #647
2014-06-16 16:13:18 -07:00
Ryan Nowak d79943d30f Fixing issues build/project issues that someone else missed. 2014-06-16 13:26:49 -07:00
harshgMSFT 170283c724 Fixing StyleCop Issues for issues reported for commit# b58083f73a 2014-06-16 13:16:37 -07:00
Ryan Nowak 1bae3bcaa2 Issue #592 - ActionResult is not being executed by ResultFilterAttribute
The issue here is actually different than described in the bug.
ResultFilter should only short circuit when .Cancel is set to true. This
is consistent with legacy MVC.

Added tests for all of this stuff. There's already good test coverage for
the invoker, what was missing was coverage for the attributes and for the
methods on Controller. ExceptionFilterAttribute and
AuthorizationFilterAttribute don't have short circuiting logic inside of
them, so they are already covered by tests for the invoker.
2014-06-16 12:42:59 -07:00
harshgMSFT 10285d7d39 This additional constraint enables adding a route to the template (and potentially to the UseMvc method) without actually implementing the actual artifact.
For example without adding an area to a controller, a route can still be added to the template.
- Also added functional tests.
2014-06-16 11:24:22 -07:00
harshgMSFT b58083f73a Renaming AntiForgeryConfig-> AntiForgeryOptions.
Adding MvcOptions and updating AntiForgery system to use AntiForgeryConfiguration from MvcOptions
2014-06-12 16:55:49 -07:00