Commit Graph

648 Commits

Author SHA1 Message Date
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
dougbu 099adda3d7 Test for XML documentation errors
- extend the "test" target in our build to use new k-xml-docs-test.shade command

Example output with one syntax error and one invalid reference:
```
info: Target xml-docs-test
warn: Invalid documentation syntax in src\Microsoft.AspNet.Mvc.Core\bin\debug\net45\Microsoft.AspNet.Mvc.Core.xml
warn:   3170: <!-- Badly formed XML comment ignored for member "T:Microsoft.AspNet.Mvc.Rendering.HtmlHelper" -->
warn:   3203: If the object is already an <see cref="!:IDictionaries&lt;string, object&gt;"/> instance, then it is
```
2014-08-11 16:23:18 -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 e96fbce95e Reverting changes to sln file made in 01f5fec210 2014-08-11 12:22:46 -07:00
harshgMSFT 927821a8ac Data Token support changes 2014-08-11 11:38:10 -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
dougbu d95b85d057 Simplify some XML comment references
- follow VS fixup suggestion and change e.g. `<see cref="System.String"/>` -> `<see cref="string"/>`
2014-08-07 17:25:06 -07:00
dougbu 147b4416b5 Correct gaps in PR #934
- correct XML comment typo introduced in `HtmlHelper` in 56d66c090e (bad merge)
- fix missed `null` requirement for `@Html.RadioButtonFor()` and remove buried `null` check
- add back `Environment.Newline` to `@Html.TextArea()` (was dropped though comment wasn't)
2014-08-07 16:16:03 -07:00
Chris Ross cd3e1da219 Fix Challenge params order. 2014-08-07 16:03:34 -07:00
harshgMSFT d3407ff212 Routing related fixes for #55 2014-08-06 17:11:29 -07:00
dougbu 7ab93d34e4 Remove incorrect references to `HtmlHelper` class
- extension methods extend `IHtmlHelper`
2014-08-06 16:08:22 -07:00
dougbu 5bdf7955a0 Correct extension class names to match containing files
- #874 line 5
- `EditorExtensions` -> `HtmlHelperEditorExtensions`
- `SelectExtensions` -> `HtmlHelperSelectExtensions`
2014-08-06 16:08:20 -07:00
dougbu f4d53a0045 Prefer `IHtmlHelper` methods elsewhere in our code
- #847 line 7 sub-bullets
- don't call extension methods from our templates
 - partially addressed in PR #934 (for methods changed there)
- don't reference extension methods from XML comments
2014-08-06 16:08:17 -07:00
dougbu 4c5aa15f0b Call `IHtmlHelper` methods from extension methods
- don't call other extension methods
- #847 line 7
- remove extension methods that do nothing but pass through to the interface method
 - weren't exactly ambiguous (interface method wins) but were useless
2014-08-06 16:08:14 -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
Pranav K 4bf078269f Updating dev Nuget.config 2014-08-06 12:30:48 -07:00
Pranav K 4642d3968d Updating release Nuget.config 2014-08-05 15:50:05 -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 eaee27756c Updating project.json to use frameworks token 2014-08-05 12:15:11 -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
dougbu dc58eb297d Remove unused `using`s from 3db0a80306 change
- see 3db0a80306
2014-08-04 18:10:50 -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 3db0a80306 Remove HTML helpers with `IDictionary<string, object>` parameters
- see line 2 of #874
- focus on `TextBox[For]()` and `ValidationSummary()`

related fixes included here:
- `TextArea[For]()` documentation incorrectly indicated their `htmlAttributes` parameters were dictionaries
- handle `htmlAttributes` parameters more consistently; create a dictionary only when necessary
2014-08-03 22:37:42 -07:00
dougbu c9b2323592 Move web site projects back where they belong
- solution corrupted in a recent checkin
2014-08-02 14:42:42 -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
dougbu 7845a8fbe1 `@Html.DisplayName()`, `.DisplayText()`, `.Id()`, `.Name()`, `.Value()` return `string`
- fixes #566 and part of #847
- allows compositions such as `@Html.Label("property", Html.Id("property"))`
  and `@Html.Raw(Html.DisplayText("property"))` (this one is not recommended)
- adjust XML comments to match
- add missing XML comments to `HtmlHelperValueExtensions`
- nit: `TInnerModel` -> `TModelItem`

- increase XML comment consistency for changed methods
 - generally make wording more consistent e.g. how we use words such as
   "returns"
 - use `<see langref="string|true|false|null"/>` more
2014-08-01 21:06:20 -07:00
Ben Brown 01f5fec210 Added Logging to Mvc 2014-08-01 15:33:47 -07:00
harshgMSFT 11d6c507f9 Stylecop fixes 2014-08-01 14:21:00 -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
David Fowler 5708f7592b Changing GetLibraryExport to GetAllExports 2014-07-31 16:55:01 -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
dougbu 7ec4ab021e Make longest `@Html.DisplayForModel()` overload an extension method
- consistent with @Html.EditorForModel()` overloads
2014-07-31 12:01:28 -07:00
dougbu 40eb05f7e4 Improve `HtmlHelper` extension points
- address all of #659 and a bit of #874 (avoid `public virtual` methods in
  `HtmlHelper`)

- make `MetadataProvider` and `GetClientValidationRules()` `public` and
  therefore available to extension methods
- remove unused `GetValidationAttributes()` overload
- make remaining `GetValidationAttributes()` overload (and not
  `GetClientValidationRules()`) `virtual`, allowing derived classes to
  change the attributes without overriding all callers
- reverse `GetValidationAttributes()` and `GetClientValidationRules()`
  parameter order to match precedence
- add `GenerateName()` and `GenerateValidationSummary()` to make
  `protected virtual` method names consistent
- `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual`
  because `protected virtual Generate*()` methods exist for all
2014-07-31 12:01:09 -07:00
dougbu b8960219b4 Fix Stylecop failure
- long line
2014-07-30 23:02:44 -07:00
harshgMSFT 8f00b9a7b4 Removing a stale proj reference in .sln 2014-07-30 14:53:04 -07:00
Pranav K 9c545aa343 Updating System.Xml.ReaderWriter to 4.0.10.0 2014-07-29 22:11:50 -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
Pranav K 225b4903cf Reacting to Roslyn package changes 2014-07-29 16:50:19 -07:00
Ryan Nowak 2987f98283 Adding parameter replacement 2014-07-29 16:14:57 -07:00
Ryan Nowak 96c759e25c 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:21:34 -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
dougbu 43d1253936 Cleanup unused `FormContext` members due to legacy validation removal
- provide new property back for customer use
- remove unused FieldValidationMetadataClass
2014-07-29 10:44:12 -07:00
dougbu b5dcc9895d Fix #620, Remove legacy / non-unobtrusive client side validation
- remove `ViewContext.UnobtrusiveJavaScriptEnabled` property and all references
- avoid `ViewContext.GetFormContextForClientValidation()` calls since
  ternary expression is more explicit and we were inconsistent
- improve `ValidationMessage()` comments
- don't treat `ModelState.IsValid` as if it were still nullable
2014-07-29 10:43:19 -07:00