Commit Graph

565 Commits

Author SHA1 Message Date
Pranav K 7dac5c711b Reacting to Hosting changes 2015-12-18 15:59:42 -08:00
ryanbrandenburg 6a16681ed4 * Replace MvcMinimalSample with functional test 2015-12-16 15:18:25 -08:00
Ajay Bhargav Baaskaran 43eb621d19 [Fixes #2743] Removed ErrorReporterMiddleware in some places 2015-12-16 14:39:35 -08:00
Ajay Bhargav Baaskaran 232b27ad5d [Fixes #3430] Removed RouteKeyHandling.CatchAll 2015-12-16 11:57:22 -08:00
Pranav K 7c40759e32 Reacting to Routing changes 2015-12-16 11:49:20 -08:00
Doug Bunting 59824dc7be MVC functional test cleanup (part 1)
- #3612 subpart 2 of 2
- merge `ActionConstraintsWebSite`, `AntiforgeryTokenWebSite` and `ContentNegotiationWebSite` into `BasicWebSite`
  - remove tests depending on `ErrorReporterMiddleware` in merged sites; not used in `BasicWebSite`
- delete `CompositeViewEngineWebSite`, `Microsoft.AspNet.Mvc.ViewEngines.CompositeViewEngineTest` covers cases
- delete `CorsMiddlewareWebsite`, soon to be in Cors repo (see aspnet/CORS#57)
- remove `SendFileMiddleware` from FilesWebSite, unused there
2015-12-14 21:50:55 -08:00
Pranav K 56c6975a21 Tweak CacheTagHelper sample to use a token provider service for
cache expiration.

Fixes #3573
2015-12-11 15:23:34 -08:00
Doug Bunting 19e6fb5719 MVC functional test cleanup part 1
- #3612 (subpart 1 of 2)
- delete six sites and associated tests entirely
  - `ActionResultsWebSite`
  - `ActivatorWebSite`
  - `ControllerDiscoveryConventionsWebSite`
  - `LoggingWebSite`
  - `LowercaseUrlsWebSite`
  - `ModelBindingWebSite`, now covered in integration tests
  - remove now-unused `FilteredDefaultAssemblyProviderFixture`, `LoggingAssert` and `LoggingExtensions`
- move six test web sites into `./samples`
  - `CustomRouteWebSite` -> `CustomRouteSample.Web`
  - `FormatFilterWebSite` -> `FormatFilterSample.Web`
  - `InlineConstraintsWebSite` -> `InlineConstraintSample.Web` (now singular)
  - `JsonPatchWebSite` -> `JsonPatchSample.Web`
  - `LocalizationWebSite` -> `LocalizationSample.Web`
  - `RazorEmbeddedViewsWebSite` -> `EmbeddedViewSample.Web` (no longer "Razor" and now singular)
  - do some cleanup: remove test dependencies, shorten sample controller names, use more attribute routing
- correct "license" spelling in `ApplicationModelWebSite`
2015-12-11 13:13:41 -08:00
ryanbrandenburg 3393ba43c2 * Parameters into the messages 2015-12-11 12:05:44 -08:00
Ryan Nowak ed93a6c812 React to routing breaking changes 2015-12-11 09:30:51 -08:00
Kiran Challa 57b88baad0 [Fixes #3624] MVC functional test cleanup (part 2) 2015-12-10 16:26:39 -08:00
Ryan Nowak 09a293afe9 React to routing cleanup 2015-12-07 13:08:13 -08:00
Kiran Challa dd774366f6 Addressed feedback 2015-12-03 14:42:14 -08:00
Kiran Challa 6712f9d9ff Deleted ValueProvidersWebSite and tests 2015-12-03 14:42:13 -08:00
Kiran Challa 9539c373ba Deleted ViewComponentWebSite and tests 2015-12-03 14:42:12 -08:00
Kiran Challa 9288ab1a34 Removed TempDataWebsite and merged to BasicWebsite and fixed tests 2015-12-03 14:42:11 -08:00
Kiran Challa 3c694ce77c Movig RequestServicesWebsite to BasicWebsite 2015-12-03 14:42:10 -08:00
Doug Bunting 42f3e764b0 Move logic from `HtmlLocalizer` to `LocalizedHtmlString`
- part of #3123 (4 of 5)
- `LocalizedHtmlString` should not subclass `HtmlString`; now implements `IHtmlContent`

nits:
- clean up a few doc comments
- remove duplicate tests reported while testing these fixes in VS
2015-12-02 18:39:37 -08:00
Ryan Nowak 9fc3a80056 Remove IActionContextAccessor from UrlHelper
This change removes the IActionContextAccessor as a dependency of
UrlHelper, and shifts UrlHelper to use a factory pattern. Consumers of
IUrlHelper should create an instance using the factory when needed.

This is the last part of MVC that has a dependency on IActionContext
accessor. As part of this change we no longer register it by default, and
treat it as an optional component.
2015-12-02 17:09:43 -08:00
Ryan Nowak 6875ee55d3 Remove Magic Link Generation
This change resolves #3512 and #3636 by removing 'magic' link generation
and adding an extension method to add routes to areas correctly using the new
pattern. This is pretty much exactly the same as how MapWebApiRoute works.

For site authors, we recommend adding area-specific routes in a way that
includes a default AND constraint for the area. Put your most specific
(for link generation) routes FIRST.

Ex:

  routes.MapRoute(
      "Admin/{controller}/{action}/{id?}",
      defaults: new { area = "Admin" },
      constraints: new { area = "Admin" });

The bulk of the changes here are to tests that unwittingly relied on the
old behavior.
2015-11-30 11:24:23 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -08:00
Doug Bunting 6e299d695f Update `DefaultHtmlGenerator.GenerateAntiforgery()` to match latest `IAntiforgery.GetHtml()`
- #3123 (3 of 5 or so)
- react to rest of aspnet/Antiforgery@6a9b38d
  - remove `HtmlEncoder` from localization requirements
  - literal `hidden` is no longer HTML encoded (was a no-op anyhow)
2015-11-25 09:49:15 -08:00
Pranav K 79d517483b Removing PageInstrumentation
Fixes #3497
2015-11-25 08:41:21 -08:00
Pavel Krymets 5ef14e95b7 React to dnx confguration change 2015-11-24 11:54:10 -08:00
ryanbrandenburg b6f8c523a8 * Remove MvcSample and replace with MvcSandbox 2015-11-23 11:53:48 -08:00
Pavel Krymets f25aab8df7 React to hosting changes 2015-11-19 16:12:50 -08:00
Doug Bunting 79d74127b9 Add temporary workarounds for aspnet/External#50 and aspnet/Mvc#3587 2015-11-19 15:50:00 -08:00
Doug Bunting 3be6167aa0 Switch concepts from misnamed `isPartial` to `isMainPage`
- `true` has the opposite meaning now but most changes are due to new parameters names in `IViewEngine`
  - use name names in `Microsoft.AspNet.Mvc.ViewFound` and not found events
- remove `IRazorPage.IsPartial` and `RazorView.IsPartial`
  - remove `IsPartial` properties from `Microsoft.AspNet.Mvc.Razor.BeginInstrumentationContext` and end events
- add parameter checks to `RazorView` constructor; instances are not retrieved from DI

nits:
- remove unused `cacheKey` parameter from `RazorViewEngine.CreateCacheResult()`
- correct duplicate test names in `RazorPageTest`
  - also `...OnPageExecutionListenerContext` -> `...OnPageExecutionContext`
2015-11-18 15:59:37 -08:00
Doug Bunting cf30bb730f PR comments and some smallish cleanup
- `IRazorViewEngine.MakePathAbsolute()` -> `GetAbsolutePath()`
- set `IsPartial` on all `IRazorPage` instances
- improve consistency of methods in `HtmlHelperPartialExtensions`
  - a couple unnecessarily passed `htmlHelper.ViewData`
  - add missing tests of these extension methods
- restore parameter checks in `CompositeViewEngine`
- reduce `List<string>` and remove enumerator allocations in `CompositeViewEngine`

nits:
- correct a few comments
- use `<seealso/>`
2015-11-18 15:59:28 -08:00
Doug Bunting 08dd77d8c7 Add relative view path support
- #3307
- relative paths are now supported in `View()` calls from components and view components,
  `Html.PartialAsync()` and similar calls, and `RazorPage.Layout` settings.
  - support absolute paths, relative paths, and view location lookups consistently / everywhere
  - support view paths in `TemplateRenderer` e.g. passing an absolute path to `Html.EditorFor()`
- take a big swing at the `IRazorViewEngine` and `IViewEngine` interfaces
  - split lookups (view names) from navigation (view paths)
  - remove `Partial` separation; use parameters to set `IsPartial` properties
- correct `ViewContext` copy constructor and add unit test
- extend unit tests to cover relative paths
  - fix existing tests to handle newly-required extension in an absolute path
- add functional test that chains relative paths

nits:
- remove some YOLO line wrapping
- `""` -> `string.Empty`
2015-11-18 15:59:11 -08:00
Kiran Challa 85080ae621 Make Cors filters run before any other authorization filters 2015-11-18 10:51:49 -08:00
Kiran Challa 982c7abea8 [Fixes #3503] Removing formatters on a given type only works on collections in MVC options 2015-11-18 09:56:44 -08:00
Pranav K b520b0cb22 Limit [FromServices] to apply only to parameters
Fixes #3507
2015-11-17 16:41:04 -08:00
Pranav K 292207d17d Reacting to DependencyInjection changes 2015-11-13 10:47:34 -08:00
Doug Bunting 845b86963e Fix build break: React to aspnet/Hosting@660f1ca 2015-11-09 21:09:21 -08:00
N. Taylor Mullen decf882341 Update `LinkTagHelper`s `meta` tag to be w3c compliant.
- Prior to this change the `<meta ...>` generated had a name attribute. As an alternative we're using the `content` attribute in conjunction with the `name` attribute to ensure compliance.

#3449
2015-11-06 12:15:55 -08:00
N. Taylor Mullen bebd3dc9a0 Update test files to showcase block level Razor statements in attributes.
- Block level Razor statements in attributes used to not work. Added a few use cases to ensure that they're properly tested.

aspnet/Razor#594
2015-11-06 11:11:40 -08:00
Kiran Challa 5364468001 [Fixes #3177] Clean up logic for encoding in ViewResult and friends 2015-11-06 10:44:09 -08:00
ryanbrandenburg cd761a644d * Adding test 2015-11-04 13:55:02 -08:00
Doug Bunting ff91e796c1 Revert "Fixing tests"
- wrong fix especially now that test encoders work as expected
- touch up `HtmlHelperTest` and `RazorViewTest` since test encoders are now consistent
- remove references to old `Microsoft.Extensions.WebEncoders.Testing` package

This reverts commit a9d5876cd9.
- but leave `FormTagHelperTest` and `ValidationMessageTagHelperTest` cleanup alone

nit: use `string.Empty` in `HtmlHelperLinkGenerationTest`
2015-11-02 09:45:56 -08:00
Pranav K a9d5876cd9 Fixing tests 2015-10-30 18:58:33 -07:00
Chris R 52f4a83139 React to WebEncoders changes. 2015-10-30 17:59:19 -07:00
Doug Bunting 53060be2d7 Content negotiation fails in subsequent requests accepting same media type
- #3140
- clone `MediaTypeHeaderValue` instance before updating it when content negotiation succeeds
  - avoids changes to `MediaTypeConstants` properties and `OutputFormatter.SupportedMediaTypes` entries
  - `MediaTypeHeaderValue.Clone()` does not exist in our DNX Core fork of this class
  - in previous implementation, was called defensively rather than when required
- update `WebApiCompatShimBasicTest` functional tests to use `MvcTestFixture<TStartup>` everywhere
  - #3140 blocked that final migration
  - remove `TestHelper` since it's no longer referenced

nits:
- remove comments mentioning `TestHelper`
- correct spelling of "negotiation"
2015-10-30 14:10:31 -07:00
Doug Bunting a69a7a6940 Simplify instrumentation confirmations in `RazorPageExecutionInstrumentationTest`
- test class can now use the `MvcTestFixture`
  - #3139 part 3 of 3
- dump instrumentation data at end of `_Layout.cshtml`
  - include `FilePath` in display
  - compare against new `.html` resource

nits:
- normalize line endings to CRLF for consistency with other tests
- add `InstrumentionData` to avoid `Tuple`
- make `TestPageExecutionContext` class `private`
- remove newly-unused actions and associated `.cshtml` files
2015-10-28 16:45:30 -07:00
Doug Bunting dc32f8ae33 PR comments: Restore most of `PrecompilationTest.PrecompiledView_RendersCorrectly()` 2015-10-28 16:40:28 -07:00
Doug Bunting c8c0c5303e Remove more `TestHelper` functional tests
- remove tests already thoroughly covered in unit tests
  - #3139 part 2 of 3
- make checks of `<form>` tag helper more consistent with others
  - use a tag helper initializer but testing every variant; covered in unit tests
- remove `MvcStartupTest` and associated web site
  - scenario covered elsewhere
- remove `PrecompilationTest.PrecompiledView_RendersCorrectly()`
  - scenario covered elsewhere and shouldn't do I/O on checked-in files
2015-10-28 16:40:13 -07:00
Doug Bunting ff19702db5 Remove `WaitService`
- use `MvcTestFixture` instead of `TestHelper`
  - part of #3139
- continue to test e2e interaction of `FlushAsync()` with sections, partials, et cetera
- remove `FlushPointTest.FlushBeforeCallingLayout()`
  - `RazorPageTest.FlushAsync_ThrowsIfTheLayoutHasBeenSet()` unit test covers the scenario
2015-10-28 15:47:16 -07:00
Pavel Krymets 4e8c543489 Rename Microsoft.Runtime.Abstractions to Microsoft.Extensions.PlatformAbstractions 2015-10-22 19:48:55 -07:00
N. Taylor Mullen 911dfc57b0 Transition `SelectTagHelper` and `OptionTagHelper` to use `context.Items`.
- Added functional tests to validate data created from a `SelectTagHelper` does not impact following `<select>` tags.
- Also moved the new `SelectTagHelper` communication flow into `TagHelper.Init`.

#3347
2015-10-22 17:17:01 -07:00
Doug Bunting 40b7636b72 Use `ModelMetadata.GetDisplayName()` in error message replacing `FormatException` and `OverflowException`
- #3227
- much of change is to tests, creating and passing `ModelMetadata`
- updated `InputFormatterContext` to make `ModelMetadata` available to `JsonInputFormatter`
  - walk `ModelMetadata` tree to get information about property with an issue
- add missing `null` checks in `ModelStateDictionaryExtensions`
2015-10-22 15:50:36 -07:00