Changes per PR comments

Reformatting parameter identation
This commit is contained in:
Pranav K 2015-09-17 15:30:39 -07:00
parent a68d9e4cb1
commit 7b433820b1
55 changed files with 333 additions and 248 deletions

View File

@ -14,7 +14,10 @@ namespace Microsoft.AspNet.JsonPatch.Converters
{ {
public class TypedJsonPatchDocumentConverter : JsonPatchDocumentConverter public class TypedJsonPatchDocumentConverter : JsonPatchDocumentConverter
{ {
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, public override object ReadJson(
JsonReader reader,
Type objectType,
object existingValue,
JsonSerializer serializer) JsonSerializer serializer)
{ {
try try

View File

@ -9,8 +9,10 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
// Helper methods to allow case-insensitive key search // Helper methods to allow case-insensitive key search
internal static class ExpandoObjectDictionaryExtensions internal static class ExpandoObjectDictionaryExtensions
{ {
internal static void SetValueForCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary, internal static void SetValueForCaseInsensitiveKey(
string key, object value) this IDictionary<string, object> propertyDictionary,
string key,
object value)
{ {
foreach (KeyValuePair<string, object> kvp in propertyDictionary) foreach (KeyValuePair<string, object> kvp in propertyDictionary)
{ {
@ -22,8 +24,9 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
} }
} }
internal static void RemoveValueForCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary, internal static void RemoveValueForCaseInsensitiveKey(
string key) this IDictionary<string, object> propertyDictionary,
string key)
{ {
string realKey = null; string realKey = null;
foreach (KeyValuePair<string, object> kvp in propertyDictionary) foreach (KeyValuePair<string, object> kvp in propertyDictionary)
@ -41,8 +44,9 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
} }
} }
internal static object GetValueForCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary, internal static object GetValueForCaseInsensitiveKey(
string key) this IDictionary<string, object> propertyDictionary,
string key)
{ {
foreach (KeyValuePair<string, object> kvp in propertyDictionary) foreach (KeyValuePair<string, object> kvp in propertyDictionary)
{ {
@ -55,8 +59,9 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
throw new ArgumentException(Resources.FormatDictionaryKeyNotFound(key)); throw new ArgumentException(Resources.FormatDictionaryKeyNotFound(key));
} }
internal static bool ContainsCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary, internal static bool ContainsCaseInsensitiveKey(
string key) this IDictionary<string, object> propertyDictionary,
string key)
{ {
foreach (KeyValuePair<string, object> kvp in propertyDictionary) foreach (KeyValuePair<string, object> kvp in propertyDictionary)
{ {
@ -65,8 +70,8 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
return true; return true;
} }
} }
return false;
return false;
} }
} }
} }

View File

@ -8,9 +8,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{ {
public class ClientModelValidationContext public class ClientModelValidationContext
{ {
public ClientModelValidationContext([NotNull] ModelMetadata metadata, public ClientModelValidationContext(
[NotNull] IModelMetadataProvider metadataProvider, [NotNull] ModelMetadata metadata,
[NotNull] IServiceProvider requestServices) [NotNull] IModelMetadataProvider metadataProvider,
[NotNull] IServiceProvider requestServices)
{ {
ModelMetadata = metadata; ModelMetadata = metadata;
MetadataProvider = metadataProvider; MetadataProvider = metadataProvider;

View File

@ -17,8 +17,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
{ {
} }
public ModelClientValidationRule([NotNull] string validationType, public ModelClientValidationRule(
[NotNull] string errorMessage) [NotNull] string validationType,
[NotNull] string errorMessage)
{ {
ValidationType = validationType; ValidationType = validationType;
ErrorMessage = errorMessage; ErrorMessage = errorMessage;

View File

@ -802,7 +802,8 @@ namespace Microsoft.AspNet.Mvc.Actions
private class MethodToActionMap : private class MethodToActionMap :
Dictionary<MethodInfo, IDictionary<ActionModel, IList<ControllerActionDescriptor>>> Dictionary<MethodInfo, IDictionary<ActionModel, IList<ControllerActionDescriptor>>>
{ {
public void AddToMethodInfo(ActionModel action, public void AddToMethodInfo(
ActionModel action,
IList<ControllerActionDescriptor> actionDescriptors) IList<ControllerActionDescriptor> actionDescriptors)
{ {
IDictionary<ActionModel, IList<ControllerActionDescriptor>> actionsForMethod = null; IDictionary<ActionModel, IList<ControllerActionDescriptor>> actionsForMethod = null;

View File

@ -46,8 +46,9 @@ namespace Microsoft.AspNet.Mvc.Actions
/// <param name="typeInfo">The <see cref="TypeInfo"/>.</param> /// <param name="typeInfo">The <see cref="TypeInfo"/>.</param>
/// <param name="candidateAssemblies">The set of candidate assemblies.</param> /// <param name="candidateAssemblies">The set of candidate assemblies.</param>
/// <returns><c>true</c> if the <paramref name="typeInfo"/> is a controller. Otherwise <c>false</c>.</returns> /// <returns><c>true</c> if the <paramref name="typeInfo"/> is a controller. Otherwise <c>false</c>.</returns>
protected internal virtual bool IsController([NotNull] TypeInfo typeInfo, protected internal virtual bool IsController(
[NotNull] ISet<Assembly> candidateAssemblies) [NotNull] TypeInfo typeInfo,
[NotNull] ISet<Assembly> candidateAssemblies)
{ {
if (!typeInfo.IsClass) if (!typeInfo.IsClass)
{ {

View File

@ -16,8 +16,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
" Route: {AttributeRouteModel?.Template}, Filters: {Filters.Count}")] " Route: {AttributeRouteModel?.Template}, Filters: {Filters.Count}")]
public class ActionModel public class ActionModel
{ {
public ActionModel([NotNull] MethodInfo actionMethod, public ActionModel(
[NotNull] IReadOnlyList<object> attributes) [NotNull] MethodInfo actionMethod,
[NotNull] IReadOnlyList<object> attributes)
{ {
ActionMethod = actionMethod; ActionMethod = actionMethod;

View File

@ -16,8 +16,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
" Routes: {AttributeRoutes.Count}, Filters: {Filters.Count}")] " Routes: {AttributeRoutes.Count}, Filters: {Filters.Count}")]
public class ControllerModel public class ControllerModel
{ {
public ControllerModel([NotNull] TypeInfo controllerType, public ControllerModel(
[NotNull] IReadOnlyList<object> attributes) [NotNull] TypeInfo controllerType,
[NotNull] IReadOnlyList<object> attributes)
{ {
ControllerType = controllerType; ControllerType = controllerType;

View File

@ -12,8 +12,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
[DebuggerDisplay("ParameterModel: Name={ParameterName}")] [DebuggerDisplay("ParameterModel: Name={ParameterName}")]
public class ParameterModel public class ParameterModel
{ {
public ParameterModel([NotNull] ParameterInfo parameterInfo, public ParameterModel(
[NotNull] IReadOnlyList<object> attributes) [NotNull] ParameterInfo parameterInfo,
[NotNull] IReadOnlyList<object> attributes)
{ {
ParameterInfo = parameterInfo; ParameterInfo = parameterInfo;

View File

@ -20,8 +20,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
/// </summary> /// </summary>
/// <param name="propertyInfo">The <see cref="PropertyInfo"/> for the underlying property.</param> /// <param name="propertyInfo">The <see cref="PropertyInfo"/> for the underlying property.</param>
/// <param name="attributes">Any attributes which are annotated on the property.</param> /// <param name="attributes">Any attributes which are annotated on the property.</param>
public PropertyModel([NotNull] PropertyInfo propertyInfo, public PropertyModel(
[NotNull] IReadOnlyList<object> attributes) [NotNull] PropertyInfo propertyInfo,
[NotNull] IReadOnlyList<object> attributes)
{ {
PropertyInfo = propertyInfo; PropertyInfo = propertyInfo;

View File

@ -25,10 +25,11 @@ namespace Microsoft.AspNet.Mvc
/// <param name="controllerName">The name of the controller to use for generating the URL.</param> /// <param name="controllerName">The name of the controller to use for generating the URL.</param>
/// <param name="routeValues">The route data to use for generating the URL.</param> /// <param name="routeValues">The route data to use for generating the URL.</param>
/// <param name="value">The value to format in the entity body.</param> /// <param name="value">The value to format in the entity body.</param>
public CreatedAtActionResult(string actionName, public CreatedAtActionResult(
string controllerName, string actionName,
object routeValues, string controllerName,
object value) object routeValues,
object value)
: base(value) : base(value)
{ {
ActionName = actionName; ActionName = actionName;

View File

@ -36,9 +36,10 @@ namespace Microsoft.AspNet.Mvc
/// <param name="routeName">The name of the route to use for generating the URL.</param> /// <param name="routeName">The name of the route to use for generating the URL.</param>
/// <param name="routeValues">The route data to use for generating the URL.</param> /// <param name="routeValues">The route data to use for generating the URL.</param>
/// <param name="value">The value to format in the entity body.</param> /// <param name="value">The value to format in the entity body.</param>
public CreatedAtRouteResult(string routeName, public CreatedAtRouteResult(
object routeValues, string routeName,
object value) object routeValues,
object value)
: base(value) : base(value)
{ {
RouteName = routeName; RouteName = routeName;

View File

@ -107,8 +107,12 @@ namespace Microsoft.AspNet.Mvc.Internal
} }
#if DNX451 #if DNX451
/// <inheritdoc /> /// <inheritdoc />
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, public override IAsyncResult BeginRead(
AsyncCallback callback, object state) byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state)
{ {
return _innerStream.BeginRead(buffer, offset, count, callback, state); return _innerStream.BeginRead(buffer, offset, count, callback, state);
} }
@ -162,8 +166,12 @@ namespace Microsoft.AspNet.Mvc.Internal
} }
#if DNX451 #if DNX451
/// <inheritdoc /> /// <inheritdoc />
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, public override IAsyncResult BeginWrite(
AsyncCallback callback, object state) byte[] buffer,
int offset,
int count,
AsyncCallback callback,
object state)
{ {
return _innerStream.BeginWrite(buffer, offset, count, callback, state); return _innerStream.BeginWrite(buffer, offset, count, callback, state);
} }

View File

@ -457,9 +457,10 @@ namespace Microsoft.AspNet.Mvc
} }
} }
internal static void ValidateBindingContext(ModelBindingContext bindingContext, internal static void ValidateBindingContext(
Type requiredType, ModelBindingContext bindingContext,
bool allowNullModel) Type requiredType,
bool allowNullModel)
{ {
ValidateBindingContext(bindingContext); ValidateBindingContext(bindingContext);

View File

@ -17,11 +17,12 @@ namespace Microsoft.AspNet.Mvc.Routing
{ {
private RouteValuesCollection _cachedValuesCollection; private RouteValuesCollection _cachedValuesCollection;
public bool Match([NotNull] HttpContext httpContext, public bool Match(
[NotNull] IRouter route, [NotNull] HttpContext httpContext,
[NotNull] string routeKey, [NotNull] IRouter route,
[NotNull] IDictionary<string, object> values, [NotNull] string routeKey,
RouteDirection routeDirection) [NotNull] IDictionary<string, object> values,
RouteDirection routeDirection)
{ {
object value; object value;
if (values.TryGetValue(routeKey, out value)) if (values.TryGetValue(routeKey, out value))

View File

@ -15,8 +15,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
/// </summary> /// </summary>
public class DataTypeAttributeAdapter : DataAnnotationsClientModelValidator<DataTypeAttribute> public class DataTypeAttributeAdapter : DataAnnotationsClientModelValidator<DataTypeAttribute>
{ {
public DataTypeAttributeAdapter(DataTypeAttribute attribute, public DataTypeAttributeAdapter(
[NotNull] string ruleName) DataTypeAttribute attribute,
[NotNull] string ruleName)
: base(attribute) : base(attribute)
{ {
if (string.IsNullOrEmpty(ruleName)) if (string.IsNullOrEmpty(ruleName))

View File

@ -13,8 +13,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
private const string EqualToValidationType = "equalto"; private const string EqualToValidationType = "equalto";
private const string EqualToValidationParameter = "other"; private const string EqualToValidationParameter = "other";
public ModelClientValidationEqualToRule([NotNull] string errorMessage, public ModelClientValidationEqualToRule(
[NotNull] object other) [NotNull] string errorMessage,
[NotNull] object other)
: base(EqualToValidationType, errorMessage) : base(EqualToValidationType, errorMessage)
{ {
ValidationParameters[EqualToValidationParameter] = other; ValidationParameters[EqualToValidationParameter] = other;

View File

@ -11,9 +11,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
private const string MinValidationParameter = "min"; private const string MinValidationParameter = "min";
private const string MaxValidationParameter = "max"; private const string MaxValidationParameter = "max";
public ModelClientValidationRangeRule([NotNull] string errorMessage, public ModelClientValidationRangeRule(
[NotNull] object minValue, [NotNull] string errorMessage,
[NotNull] object maxValue) [NotNull] object minValue,
[NotNull] object maxValue)
: base(RangeValidationType, errorMessage) : base(RangeValidationType, errorMessage)
{ {
ValidationParameters[MinValidationParameter] = minValue; ValidationParameters[MinValidationParameter] = minValue;

View File

@ -156,8 +156,9 @@ namespace Microsoft.AspNet.Mvc.Formatters
/// </summary> /// </summary>
/// <param name="writeStream">The stream on which the XmlWriter should operate on.</param> /// <param name="writeStream">The stream on which the XmlWriter should operate on.</param>
/// <returns>A new instance of <see cref="XmlWriter"/></returns> /// <returns>A new instance of <see cref="XmlWriter"/></returns>
public virtual XmlWriter CreateXmlWriter([NotNull] Stream writeStream, public virtual XmlWriter CreateXmlWriter(
[NotNull] XmlWriterSettings xmlWriterSettings) [NotNull] Stream writeStream,
[NotNull] XmlWriterSettings xmlWriterSettings)
{ {
return XmlWriter.Create( return XmlWriter.Create(
new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding), new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding),

View File

@ -131,8 +131,9 @@ namespace Microsoft.AspNet.Mvc.Formatters
/// </summary> /// </summary>
/// <param name="writeStream">The stream on which the XmlWriter should operate on.</param> /// <param name="writeStream">The stream on which the XmlWriter should operate on.</param>
/// <returns>A new instance of <see cref="XmlWriter"/></returns> /// <returns>A new instance of <see cref="XmlWriter"/></returns>
public virtual XmlWriter CreateXmlWriter([NotNull] Stream writeStream, public virtual XmlWriter CreateXmlWriter(
[NotNull] XmlWriterSettings xmlWriterSettings) [NotNull] Stream writeStream,
[NotNull] XmlWriterSettings xmlWriterSettings)
{ {
return XmlWriter.Create( return XmlWriter.Create(
new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding), new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding),

View File

@ -31,8 +31,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives
} }
// Internal for unit testing // Internal for unit testing
internal DefaultChunkTreeCache(IFileProvider fileProvider, internal DefaultChunkTreeCache(
MemoryCacheOptions options) IFileProvider fileProvider,
MemoryCacheOptions options)
{ {
_fileProvider = fileProvider; _fileProvider = fileProvider;
_chunkTreeCache = new MemoryCache(options); _chunkTreeCache = new MemoryCache(options);

View File

@ -12,9 +12,10 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
private readonly string _injectAttribute; private readonly string _injectAttribute;
public InjectChunkVisitor(CSharpCodeWriter writer, public InjectChunkVisitor(
CodeGeneratorContext context, CSharpCodeWriter writer,
string injectAttributeName) CodeGeneratorContext context,
string injectAttributeName)
: base(writer, context) : base(writer, context)
{ {
if (writer == null) if (writer == null)

View File

@ -10,8 +10,9 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
public abstract class MvcCSharpChunkVisitor : CodeVisitor<CSharpCodeWriter> public abstract class MvcCSharpChunkVisitor : CodeVisitor<CSharpCodeWriter>
{ {
public MvcCSharpChunkVisitor(CSharpCodeWriter writer, public MvcCSharpChunkVisitor(
CodeGeneratorContext context) CSharpCodeWriter writer,
CodeGeneratorContext context)
: base(writer, context) : base(writer, context)
{ {
if (writer == null) if (writer == null)

View File

@ -49,11 +49,6 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
IDictionary<string, Type> precompiledViews) IDictionary<string, Type> precompiledViews)
: this(fileProvider) : this(fileProvider)
{ {
if (fileProvider == null)
{
throw new ArgumentNullException(nameof(fileProvider));
}
if (precompiledViews == null) if (precompiledViews == null)
{ {
throw new ArgumentNullException(nameof(precompiledViews)); throw new ArgumentNullException(nameof(precompiledViews));

View File

@ -331,9 +331,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Precompilation
private class PrecompileRazorFileInfoCollection : RazorFileInfoCollection private class PrecompileRazorFileInfoCollection : RazorFileInfoCollection
{ {
public PrecompileRazorFileInfoCollection(string assemblyResourceName, public PrecompileRazorFileInfoCollection(
string symbolsResourceName, string assemblyResourceName,
IReadOnlyList<RazorFileInfo> fileInfos) string symbolsResourceName,
IReadOnlyList<RazorFileInfo> fileInfos)
{ {
AssemblyResourceName = assemblyResourceName; AssemblyResourceName = assemblyResourceName;
SymbolsResourceName = symbolsResourceName; SymbolsResourceName = symbolsResourceName;

View File

@ -38,11 +38,11 @@ namespace Microsoft.AspNet.Mvc.Razor
/// pages</param> /// pages</param>
public RazorView( public RazorView(
IRazorViewEngine viewEngine, IRazorViewEngine viewEngine,
IRazorPageActivator pageActivator, IRazorPageActivator pageActivator,
IViewStartProvider viewStartProvider, IViewStartProvider viewStartProvider,
IRazorPage razorPage, IRazorPage razorPage,
IHtmlEncoder htmlEncoder, IHtmlEncoder htmlEncoder,
bool isPartial) bool isPartial)
{ {
_viewEngine = viewEngine; _viewEngine = viewEngine;
_pageActivator = pageActivator; _pageActivator = pageActivator;
@ -81,11 +81,6 @@ namespace Microsoft.AspNet.Mvc.Razor
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
_pageExecutionFeature = context.HttpContext.Features.Get<IPageExecutionListenerFeature>(); _pageExecutionFeature = context.HttpContext.Features.Get<IPageExecutionListenerFeature>();
// Partials don't execute _ViewStart pages, but may execute Layout pages if the Layout property // Partials don't execute _ViewStart pages, but may execute Layout pages if the Layout property

View File

@ -22,8 +22,9 @@ namespace Microsoft.AspNet.Mvc
{ {
} }
private static void ConfigureRazor(RazorViewEngineOptions razorOptions, private static void ConfigureRazor(
IApplicationEnvironment applicationEnvironment) RazorViewEngineOptions razorOptions,
IApplicationEnvironment applicationEnvironment)
{ {
razorOptions.FileProvider = new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath); razorOptions.FileProvider = new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath);
} }

View File

@ -30,11 +30,6 @@ namespace Microsoft.AspNet.Mvc.Razor
throw new ArgumentNullException(nameof(foundLocation)); throw new ArgumentNullException(nameof(foundLocation));
} }
if (searchedLocations == null)
{
throw new ArgumentNullException(nameof(searchedLocations));
}
ViewLocation = foundLocation; ViewLocation = foundLocation;
SearchedLocations = searchedLocations; SearchedLocations = searchedLocations;
IsFoundResult = true; IsFoundResult = true;

View File

@ -17,9 +17,10 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <param name="actionContext">The <see cref="Mvc.ActionContext"/> for the current executing action.</param> /// <param name="actionContext">The <see cref="Mvc.ActionContext"/> for the current executing action.</param>
/// <param name="viewName">The view name.</param> /// <param name="viewName">The view name.</param>
/// <param name="isPartial">Determines if the view being discovered is a partial.</param> /// <param name="isPartial">Determines if the view being discovered is a partial.</param>
public ViewLocationExpanderContext(ActionContext actionContext, public ViewLocationExpanderContext(
string viewName, ActionContext actionContext,
bool isPartial) string viewName,
bool isPartial)
{ {
if (actionContext == null) if (actionContext == null)
{ {

View File

@ -237,10 +237,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
return options; return options;
} }
private static void AddStringCollectionKey(StringBuilder builder, private static void AddStringCollectionKey(
string keyName, StringBuilder builder,
string value, string keyName,
IReadableStringCollection sourceCollection) string value,
IReadableStringCollection sourceCollection)
{ {
if (!string.IsNullOrEmpty(value)) if (!string.IsNullOrEmpty(value))
{ {

View File

@ -570,8 +570,10 @@ namespace Microsoft.AspNet.Mvc
/// <param name="routeValues">The parameters for a route.</param> /// <param name="routeValues">The parameters for a route.</param>
/// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns> /// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns>
[NonAction] [NonAction]
public virtual RedirectToActionResult RedirectToAction(string actionName, string controllerName, public virtual RedirectToActionResult RedirectToAction(
object routeValues) string actionName,
string controllerName,
object routeValues)
{ {
return new RedirectToActionResult(actionName, controllerName, PropertyHelper.ObjectToDictionary(routeValues)) return new RedirectToActionResult(actionName, controllerName, PropertyHelper.ObjectToDictionary(routeValues))
{ {
@ -627,8 +629,10 @@ namespace Microsoft.AspNet.Mvc
/// <param name="routeValues">The parameters for a route.</param> /// <param name="routeValues">The parameters for a route.</param>
/// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns> /// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns>
[NonAction] [NonAction]
public virtual RedirectToActionResult RedirectToActionPermanent(string actionName, string controllerName, public virtual RedirectToActionResult RedirectToActionPermanent(
object routeValues) string actionName,
string controllerName,
object routeValues)
{ {
return new RedirectToActionResult( return new RedirectToActionResult(
actionName, actionName,
@ -984,10 +988,11 @@ namespace Microsoft.AspNet.Mvc
/// <param name="value">The content value to format in the entity body.</param> /// <param name="value">The content value to format in the entity body.</param>
/// <returns>The created <see cref="CreatedAtRouteResult"/> for the response.</returns> /// <returns>The created <see cref="CreatedAtRouteResult"/> for the response.</returns>
[NonAction] [NonAction]
public virtual CreatedAtActionResult CreatedAtAction(string actionName, public virtual CreatedAtActionResult CreatedAtAction(
string controllerName, string actionName,
object routeValues, string controllerName,
object value) object routeValues,
object value)
{ {
var disposableValue = value as IDisposable; var disposableValue = value as IDisposable;
if (disposableValue != null) if (disposableValue != null)

View File

@ -24,22 +24,25 @@ namespace Microsoft.AspNet.Mvc.ViewEngines
public IReadOnlyList<IViewEngine> ViewEngines { get; } public IReadOnlyList<IViewEngine> ViewEngines { get; }
/// <inheritdoc /> /// <inheritdoc />
public ViewEngineResult FindPartialView([NotNull] ActionContext context, public ViewEngineResult FindPartialView(
[NotNull] string partialViewName) [NotNull] ActionContext context,
[NotNull] string partialViewName)
{ {
return FindView(context, partialViewName, partial: true); return FindView(context, partialViewName, partial: true);
} }
/// <inheritdoc /> /// <inheritdoc />
public ViewEngineResult FindView([NotNull] ActionContext context, public ViewEngineResult FindView(
[NotNull] string viewName) [NotNull] ActionContext context,
[NotNull] string viewName)
{ {
return FindView(context, viewName, partial: false); return FindView(context, viewName, partial: false);
} }
private ViewEngineResult FindView(ActionContext context, private ViewEngineResult FindView(
string viewName, ActionContext context,
bool partial) string viewName,
bool partial)
{ {
var searchedLocations = Enumerable.Empty<string>(); var searchedLocations = Enumerable.Empty<string>();
foreach (var engine in ViewEngines) foreach (var engine in ViewEngines)

View File

@ -25,8 +25,9 @@ namespace Microsoft.AspNet.Mvc.ViewEngines
get { return View != null; } get { return View != null; }
} }
public static ViewEngineResult NotFound([NotNull] string viewName, public static ViewEngineResult NotFound(
[NotNull] IEnumerable<string> searchedLocations) [NotNull] string viewName,
[NotNull] IEnumerable<string> searchedLocations)
{ {
return new ViewEngineResult return new ViewEngineResult
{ {

View File

@ -283,10 +283,11 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
} }
/// <inheritdoc /> /// <inheritdoc />
public IHtmlContent Display(string expression, public IHtmlContent Display(
string templateName, string expression,
string htmlFieldName, string templateName,
object additionalViewData) string htmlFieldName,
object additionalViewData)
{ {
var metadata = ExpressionMetadataProvider.FromStringExpression(expression, ViewData, MetadataProvider); var metadata = ExpressionMetadataProvider.FromStringExpression(expression, ViewData, MetadataProvider);

View File

@ -23,14 +23,15 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
private bool _readOnly; private bool _readOnly;
private object _additionalViewData; private object _additionalViewData;
public TemplateBuilder([NotNull] IViewEngine viewEngine, public TemplateBuilder(
[NotNull] ViewContext viewContext, [NotNull] IViewEngine viewEngine,
[NotNull] ViewDataDictionary viewData, [NotNull] ViewContext viewContext,
[NotNull] ModelExplorer modelExplorer, [NotNull] ViewDataDictionary viewData,
string htmlFieldName, [NotNull] ModelExplorer modelExplorer,
string templateName, string htmlFieldName,
bool readOnly, string templateName,
object additionalViewData) bool readOnly,
object additionalViewData)
{ {
_viewEngine = viewEngine; _viewEngine = viewEngine;
_viewContext = viewContext; _viewContext = viewContext;

View File

@ -45,8 +45,10 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
return results; return results;
} }
private static void ValidateUnobtrusiveValidationRule(ModelClientValidationRule rule, private static void ValidateUnobtrusiveValidationRule(
IDictionary<string, object> resultsDictionary, string dictionaryKey) ModelClientValidationRule rule,
IDictionary<string, object> resultsDictionary,
string dictionaryKey)
{ {
if (string.IsNullOrEmpty(rule.ValidationType)) if (string.IsNullOrEmpty(rule.ValidationType))
{ {

View File

@ -28,8 +28,9 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
/// </param> /// </param>
/// <param name="modelState"><see cref="ModelStateDictionary"/> instance for this scope.</param> /// <param name="modelState"><see cref="ModelStateDictionary"/> instance for this scope.</param>
/// <remarks>For use when creating a <see cref="ViewDataDictionary"/> for a new top-level scope.</remarks> /// <remarks>For use when creating a <see cref="ViewDataDictionary"/> for a new top-level scope.</remarks>
public ViewDataDictionary([NotNull] IModelMetadataProvider metadataProvider, public ViewDataDictionary(
[NotNull] ModelStateDictionary modelState) [NotNull] IModelMetadataProvider metadataProvider,
[NotNull] ModelStateDictionary modelState)
: this(metadataProvider, modelState, declaredModelType: typeof(object)) : this(metadataProvider, modelState, declaredModelType: typeof(object))
{ {
} }

View File

@ -28,12 +28,13 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
/// <param name="viewData">The <see cref="ViewDataDictionary"/> for the view being rendered.</param> /// <param name="viewData">The <see cref="ViewDataDictionary"/> for the view being rendered.</param>
/// <param name="tempData">The <see cref="ITempDataDictionary"/> for the view being rendered.</param> /// <param name="tempData">The <see cref="ITempDataDictionary"/> for the view being rendered.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous rendering.</returns> /// <returns>A <see cref="Task"/> that represents the asynchronous rendering.</returns>
public static async Task ExecuteAsync([NotNull] IView view, public static async Task ExecuteAsync(
[NotNull] ActionContext actionContext, [NotNull] IView view,
[NotNull] ViewDataDictionary viewData, [NotNull] ActionContext actionContext,
[NotNull] ITempDataDictionary tempData, [NotNull] ViewDataDictionary viewData,
[NotNull] HtmlHelperOptions htmlHelperOptions, [NotNull] ITempDataDictionary tempData,
MediaTypeHeaderValue contentType) [NotNull] HtmlHelperOptions htmlHelperOptions,
MediaTypeHeaderValue contentType)
{ {
var response = actionContext.HttpContext.Response; var response = actionContext.HttpContext.Response;

View File

@ -40,8 +40,9 @@ namespace System.Net.Http.Formatting
/// <param name="stringWithQuality1">The first value to compare.</param> /// <param name="stringWithQuality1">The first value to compare.</param>
/// <param name="stringWithQuality2">The second value to compare</param> /// <param name="stringWithQuality2">The second value to compare</param>
/// <returns>The result of the comparison.</returns> /// <returns>The result of the comparison.</returns>
public int Compare(StringWithQualityHeaderValue stringWithQuality1, public int Compare(
StringWithQualityHeaderValue stringWithQuality2) StringWithQualityHeaderValue stringWithQuality1,
StringWithQualityHeaderValue stringWithQuality2)
{ {
Debug.Assert(stringWithQuality1 != null); Debug.Assert(stringWithQuality1 != null);
Debug.Assert(stringWithQuality2 != null); Debug.Assert(stringWithQuality2 != null);

View File

@ -33,10 +33,11 @@ namespace Microsoft.AspNet.Mvc.Formatters
[Theory] [Theory]
[MemberData(nameof(OutputFormatterContextValues_CanWriteType))] [MemberData(nameof(OutputFormatterContextValues_CanWriteType))]
public void CanWriteResult_ByDefault_ReturnsTrue_IfTheValueIsNull(object value, public void CanWriteResult_ByDefault_ReturnsTrue_IfTheValueIsNull(
bool declaredTypeAsString, object value,
bool expectedCanwriteResult, bool declaredTypeAsString,
bool useNonNullContentType) bool expectedCanwriteResult,
bool useNonNullContentType)
{ {
// Arrange // Arrange
var typeToUse = declaredTypeAsString ? typeof(string) : typeof(object); var typeToUse = declaredTypeAsString ? typeof(string) : typeof(object);

View File

@ -42,10 +42,11 @@ namespace Microsoft.AspNet.Mvc.Formatters
[Theory] [Theory]
[MemberData(nameof(SelectResponseCharacterEncodingData))] [MemberData(nameof(SelectResponseCharacterEncodingData))]
public void SelectResponseCharacterEncoding_SelectsEncoding(string acceptCharsetHeaders, public void SelectResponseCharacterEncoding_SelectsEncoding(
string requestEncoding, string acceptCharsetHeaders,
string[] supportedEncodings, string requestEncoding,
string expectedEncoding) string[] supportedEncodings,
string expectedEncoding)
{ {
// Arrange // Arrange
var mockHttpContext = new Mock<HttpContext>(); var mockHttpContext = new Mock<HttpContext>();

View File

@ -45,9 +45,10 @@ namespace Microsoft.AspNet.Mvc
[Theory] [Theory]
[InlineData("", "/Home/About", "/Home/About")] [InlineData("", "/Home/About", "/Home/About")]
[InlineData("/myapproot", "/test", "/test")] [InlineData("/myapproot", "/test", "/test")]
public void Execute_ReturnsContentPath_WhenItDoesNotStartWithTilde(string appRoot, public void Execute_ReturnsContentPath_WhenItDoesNotStartWithTilde(
string contentPath, string appRoot,
string expectedPath) string contentPath,
string expectedPath)
{ {
// Arrange // Arrange
var httpResponse = new Mock<HttpResponse>(); var httpResponse = new Mock<HttpResponse>();
@ -72,9 +73,10 @@ namespace Microsoft.AspNet.Mvc
[InlineData("/", "~/", "/")] [InlineData("/", "~/", "/")]
[InlineData("", "~/Home/About", "/Home/About")] [InlineData("", "~/Home/About", "/Home/About")]
[InlineData("/myapproot", "~/", "/myapproot/")] [InlineData("/myapproot", "~/", "/myapproot/")]
public void Execute_ReturnsAppRelativePath_WhenItStartsWithTilde(string appRoot, public void Execute_ReturnsAppRelativePath_WhenItStartsWithTilde(
string contentPath, string appRoot,
string expectedPath) string contentPath,
string expectedPath)
{ {
// Arrange // Arrange
var httpResponse = new Mock<HttpResponse>(); var httpResponse = new Mock<HttpResponse>();
@ -110,10 +112,11 @@ namespace Microsoft.AspNet.Mvc
return serviceCollection.BuildServiceProvider(); return serviceCollection.BuildServiceProvider();
} }
private static HttpContext GetHttpContext(string appRoot, private static HttpContext GetHttpContext(
string contentPath, string appRoot,
string expectedPath, string contentPath,
HttpResponse response) string expectedPath,
HttpResponse response)
{ {
var httpContext = new Mock<HttpContext>(); var httpContext = new Mock<HttpContext>();
var actionContext = GetActionContext(httpContext.Object); var actionContext = GetActionContext(httpContext.Object);

View File

@ -25,9 +25,10 @@ namespace Microsoft.AspNet.Mvc.Routing
[InlineData("/myapproot", null, null)] [InlineData("/myapproot", null, null)]
[InlineData("", "/Home/About", "/Home/About")] [InlineData("", "/Home/About", "/Home/About")]
[InlineData("/myapproot", "/test", "/test")] [InlineData("/myapproot", "/test", "/test")]
public void Content_ReturnsContentPath_WhenItDoesNotStartWithToken(string appRoot, public void Content_ReturnsContentPath_WhenItDoesNotStartWithToken(
string contentPath, string appRoot,
string expectedPath) string contentPath,
string expectedPath)
{ {
// Arrange // Arrange
var context = CreateHttpContext(GetServices(), appRoot); var context = CreateHttpContext(GetServices(), appRoot);
@ -49,9 +50,10 @@ namespace Microsoft.AspNet.Mvc.Routing
[InlineData("", "~/Home/About", "/Home/About")] [InlineData("", "~/Home/About", "/Home/About")]
[InlineData("/", "~", "/")] [InlineData("/", "~", "/")]
[InlineData("/myapproot", "~/Content/bootstrap.css", "/myapproot/Content/bootstrap.css")] [InlineData("/myapproot", "~/Content/bootstrap.css", "/myapproot/Content/bootstrap.css")]
public void Content_ReturnsAppRelativePath_WhenItStartsWithToken(string appRoot, public void Content_ReturnsAppRelativePath_WhenItStartsWithToken(
string contentPath, string appRoot,
string expectedPath) string contentPath,
string expectedPath)
{ {
// Arrange // Arrange
var context = CreateHttpContext(GetServices(), appRoot); var context = CreateHttpContext(GetServices(), appRoot);

View File

@ -598,7 +598,9 @@ namespace Microsoft.AspNet.Mvc.Formatters.Xml
XmlAssert.Equal(expectedOutput, content); XmlAssert.Equal(expectedOutput, content);
} }
private OutputFormatterContext GetOutputFormatterContext(object outputValue, Type outputType, private OutputFormatterContext GetOutputFormatterContext(
object outputValue,
Type outputType,
string contentType = "application/xml; charset=utf-8") string contentType = "application/xml; charset=utf-8")
{ {
return new OutputFormatterContext return new OutputFormatterContext

View File

@ -64,8 +64,9 @@ namespace Microsoft.AspNet.Mvc.Razor
[InlineData("Foo?", "Foo?")] [InlineData("Foo?", "Foo?")]
[InlineData("Foo[[]][]", "Foo[[]][]")] [InlineData("Foo[[]][]", "Foo[[]][]")]
[InlineData("$rootnamespace$.MyModel", "$rootnamespace$.MyModel")] [InlineData("$rootnamespace$.MyModel", "$rootnamespace$.MyModel")]
public void ParseModelKeyword_InfersBaseType_FromModelName(string modelName, public void ParseModelKeyword_InfersBaseType_FromModelName(
string expectedModel) string modelName,
string expectedModel)
{ {
// Arrange // Arrange
var documentContent = "@model " + modelName + Environment.NewLine + "Bar"; var documentContent = "@model " + modelName + Environment.NewLine + "Bar";
@ -270,9 +271,10 @@ namespace Microsoft.AspNet.Mvc.Razor
[InlineData(" Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?> MyHelper ", [InlineData(" Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?> MyHelper ",
"Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?>", "MyHelper")] "Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?>", "MyHelper")]
[InlineData(" TestService @class ", "TestService", "@class")] [InlineData(" TestService @class ", "TestService", "@class")]
public void ParseInjectKeyword_InfersTypeAndPropertyName(string injectStatement, public void ParseInjectKeyword_InfersTypeAndPropertyName(
string expectedService, string injectStatement,
string expectedPropertyName) string expectedService,
string expectedPropertyName)
{ {
// Arrange // Arrange
var documentContent = "@inject " + injectStatement; var documentContent = "@inject " + injectStatement;
@ -348,9 +350,10 @@ namespace Microsoft.AspNet.Mvc.Razor
[Theory] [Theory]
[InlineData("IMyService Service ", "IMyService", "Service")] [InlineData("IMyService Service ", "IMyService", "Service")]
[InlineData(" TestService @namespace ", "TestService", "@namespace")] [InlineData(" TestService @namespace ", "TestService", "@namespace")]
public void ParseInjectKeyword_ParsesUpToNewLine(string injectStatement, public void ParseInjectKeyword_ParsesUpToNewLine(
string expectedService, string injectStatement,
string expectedPropertyName) string expectedService,
string expectedPropertyName)
{ {
// Arrange // Arrange
var documentContent = "@inject " + injectStatement + Environment.NewLine + "Bar"; var documentContent = "@inject " + injectStatement + Environment.NewLine + "Bar";
@ -514,9 +517,10 @@ namespace Microsoft.AspNet.Mvc.Razor
Assert.Equal(expectedErrors, errors); Assert.Equal(expectedErrors, errors);
} }
private static List<Span> ParseDocument(string documentContents, private static List<Span> ParseDocument(
List<RazorError> errors = null, string documentContents,
List<LineMapping> lineMappings = null) List<RazorError> errors = null,
List<LineMapping> lineMappings = null)
{ {
errors = errors ?? new List<RazorError>(); errors = errors ?? new List<RazorError>();
var markupParser = new HtmlMarkupParser(); var markupParser = new HtmlMarkupParser();

View File

@ -234,9 +234,10 @@ namespace Microsoft.AspNet.Mvc.Razor
private class TestableMvcRazorParser : MvcRazorParser private class TestableMvcRazorParser : MvcRazorParser
{ {
public TestableMvcRazorParser(RazorParser parser, public TestableMvcRazorParser(
IReadOnlyList<ChunkTree> chunkTrees, RazorParser parser,
IReadOnlyList<Chunk> defaultInheritedChunks) IReadOnlyList<ChunkTree> chunkTrees,
IReadOnlyList<Chunk> defaultInheritedChunks)
: base(parser, chunkTrees, defaultInheritedChunks, typeof(ModelExpression).FullName) : base(parser, chunkTrees, defaultInheritedChunks, typeof(ModelExpression).FullName)
{ {
} }

View File

@ -14,9 +14,10 @@ namespace Microsoft.AspNet.Mvc.Razor
[Theory] [Theory]
[InlineData("SomeType", "SomeType", "SomeMethod(__model => __model.MyValue)")] [InlineData("SomeType", "SomeType", "SomeMethod(__model => __model.MyValue)")]
[InlineData("SomeType", "SomeType2", "MyValue")] [InlineData("SomeType", "SomeType2", "MyValue")]
public void RenderAttributeValue_RendersModelExpressionsCorrectly(string modelExpressionType, public void RenderAttributeValue_RendersModelExpressionsCorrectly(
string propertyType, string modelExpressionType,
string expectedValue) string propertyType,
string expectedValue)
{ {
// Arrange // Arrange
var renderer = new MvcTagHelperAttributeValueCodeRenderer( var renderer = new MvcTagHelperAttributeValueCodeRenderer(

View File

@ -700,7 +700,7 @@ namespace Microsoft.AspNet.Mvc.Razor
p.WriteAttribute("href", p.WriteAttribute("href",
new PositionTagged<string>("prefix", 0), new PositionTagged<string>("prefix", 0),
new PositionTagged<string>("suffix", 10), new PositionTagged<string>("suffix", 10),
new AttributeValue(new PositionTagged<string>("", 6), new AttributeValue(new PositionTagged<string>(string.Empty, 6),
new PositionTagged<object>("true", 6), new PositionTagged<object>("true", 6),
literal: false)); literal: false));
}); });
@ -756,7 +756,7 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
new AttributeValue[] { new AttributeValue[] {
new AttributeValue( new AttributeValue(
new PositionTagged<string>("", 9), new PositionTagged<string>(string.Empty, 9),
new PositionTagged<object>("Hello", 9), new PositionTagged<object>("Hello", 9),
literal: true) literal: true)
}, },
@ -778,7 +778,7 @@ namespace Microsoft.AspNet.Mvc.Razor
new PositionTagged<object>(null, 10), new PositionTagged<object>(null, 10),
literal: false) literal: false)
}, },
"" string.Empty
}, },
{ {
new AttributeValue[] { new AttributeValue[] {
@ -806,7 +806,7 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
new AttributeValue[] { new AttributeValue[] {
new AttributeValue( new AttributeValue(
new PositionTagged<string>("", 9), new PositionTagged<string>(string.Empty, 9),
new PositionTagged<object>("prefix", 9), new PositionTagged<object>("prefix", 9),
literal: true), literal: true),
new AttributeValue( new AttributeValue(
@ -859,7 +859,7 @@ namespace Microsoft.AspNet.Mvc.Razor
} }
[Theory] [Theory]
[InlineData(null, "")] [InlineData(null, string.Empty)]
[InlineData(false, "False")] [InlineData(false, "False")]
public void AddHtmlAttributeValues_OnlyAddsToAllAttributesWhenAttributeRemoved( public void AddHtmlAttributeValues_OnlyAddsToAllAttributesWhenAttributeRemoved(
object attributeValue, object attributeValue,
@ -939,7 +939,7 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
new AttributeValue[] { new AttributeValue[] {
new AttributeValue( new AttributeValue(
new PositionTagged<string>("", 9), new PositionTagged<string>(string.Empty, 9),
new PositionTagged<object>(true, 9), new PositionTagged<object>(true, 9),
literal: false) literal: false)
}, },
@ -948,20 +948,20 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
new AttributeValue[] { new AttributeValue[] {
new AttributeValue( new AttributeValue(
new PositionTagged<string>("", 9), new PositionTagged<string>(string.Empty, 9),
new PositionTagged<object>(false, 9), new PositionTagged<object>(false, 9),
literal: false) literal: false)
}, },
"" string.Empty
}, },
{ {
new AttributeValue[] { new AttributeValue[] {
new AttributeValue( new AttributeValue(
new PositionTagged<string>("", 9), new PositionTagged<string>(string.Empty, 9),
new PositionTagged<object>(null, 9), new PositionTagged<object>(null, 9),
literal: false) literal: false)
}, },
"" string.Empty
}, },
{ {
new AttributeValue[] { new AttributeValue[] {
@ -1007,7 +1007,7 @@ namespace Microsoft.AspNet.Mvc.Razor
page.HtmlEncoder = new CommonTestEncoder(); page.HtmlEncoder = new CommonTestEncoder();
var writer = new StringWriter(); var writer = new StringWriter();
var prefix = new PositionTagged<string>("someattr=", 0); var prefix = new PositionTagged<string>("someattr=", 0);
var suffix = new PositionTagged<string>("", 0); var suffix = new PositionTagged<string>(string.Empty, 0);
// Act // Act
page.WriteAttributeTo(writer, "someattr", prefix, suffix, attributeValues); page.WriteAttributeTo(writer, "someattr", prefix, suffix, attributeValues);
@ -1059,7 +1059,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.StartTagAndEndTag, tagMode: TagMode.StartTagAndEndTag,
preElement: null, preElement: null,
@ -1358,7 +1358,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.StartTagAndEndTag, tagMode: TagMode.StartTagAndEndTag,
preElement: "Before", preElement: "Before",
@ -1370,7 +1370,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList { { "test", "testVal" } }, attributes: new TagHelperAttributeList { { "test", "testVal" } },
tagMode: TagMode.SelfClosing, tagMode: TagMode.SelfClosing,
preElement: "Before", preElement: "Before",
@ -1406,7 +1406,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList { { "test", "testVal" } }, attributes: new TagHelperAttributeList { { "test", "testVal" } },
tagMode: TagMode.StartTagOnly, tagMode: TagMode.StartTagOnly,
preElement: "Before", preElement: "Before",
@ -1454,7 +1454,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.StartTagAndEndTag, tagMode: TagMode.StartTagAndEndTag,
preElement: null, preElement: null,
@ -1466,7 +1466,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList { { "test", "testVal" } }, attributes: new TagHelperAttributeList { { "test", "testVal" } },
tagMode: TagMode.SelfClosing, tagMode: TagMode.SelfClosing,
preElement: null, preElement: null,
@ -1502,7 +1502,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList { { "test", "testVal" } }, attributes: new TagHelperAttributeList { { "test", "testVal" } },
tagMode: TagMode.StartTagOnly, tagMode: TagMode.StartTagOnly,
preElement: null, preElement: null,
@ -1574,7 +1574,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.SelfClosing, tagMode: TagMode.SelfClosing,
preElement: "Before", preElement: "Before",
@ -1598,7 +1598,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.StartTagOnly, tagMode: TagMode.StartTagOnly,
preElement: "Before", preElement: "Before",
@ -1610,7 +1610,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList(), attributes: new TagHelperAttributeList(),
tagMode: TagMode.StartTagAndEndTag, tagMode: TagMode.StartTagAndEndTag,
preElement: "Before", preElement: "Before",
@ -1622,7 +1622,7 @@ namespace Microsoft.AspNet.Mvc.Razor
}, },
{ {
GetTagHelperOutput( GetTagHelperOutput(
tagName: "", tagName: string.Empty,
attributes: new TagHelperAttributeList { { "test", "testVal" } }, attributes: new TagHelperAttributeList { { "test", "testVal" } },
tagMode: TagMode.StartTagAndEndTag, tagMode: TagMode.StartTagAndEndTag,
preElement: "Before", preElement: "Before",

View File

@ -338,8 +338,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
[Theory] [Theory]
[MemberData(nameof(ViewLocationExpanderTestData))] [MemberData(nameof(ViewLocationExpanderTestData))]
public void FindView_UsesViewLocationExpandersToLocateViews(IDictionary<string, object> routeValues, public void FindView_UsesViewLocationExpandersToLocateViews(
IEnumerable<string> expectedSeeds) IDictionary<string, object> routeValues,
IEnumerable<string> expectedSeeds)
{ {
// Arrange // Arrange
var pageFactory = new Mock<IRazorPageFactory>(); var pageFactory = new Mock<IRazorPageFactory>();
@ -589,8 +590,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
[Theory] [Theory]
[MemberData(nameof(ViewLocationExpanderTestData))] [MemberData(nameof(ViewLocationExpanderTestData))]
public void FindPage_UsesViewLocationExpander_ToExpandPaths(IDictionary<string, object> routeValues, public void FindPage_UsesViewLocationExpander_ToExpandPaths(
IEnumerable<string> expectedSeeds) IDictionary<string, object> routeValues,
IEnumerable<string> expectedSeeds)
{ {
// Arrange // Arrange
var page = Mock.Of<IRazorPage>(); var page = Mock.Of<IRazorPage>();
@ -1082,10 +1084,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
} }
} }
private RazorViewEngine CreateViewEngine(IRazorPageFactory pageFactory = null, private RazorViewEngine CreateViewEngine(
IRazorViewFactory viewFactory = null, IRazorPageFactory pageFactory = null,
IEnumerable<IViewLocationExpander> expanders = null, IRazorViewFactory viewFactory = null,
IViewLocationCache cache = null) IEnumerable<IViewLocationExpander> expanders = null,
IViewLocationCache cache = null)
{ {
pageFactory = pageFactory ?? Mock.Of<IRazorPageFactory>(); pageFactory = pageFactory ?? Mock.Of<IRazorPageFactory>();
viewFactory = viewFactory ?? Mock.Of<IRazorViewFactory>(); viewFactory = viewFactory ?? Mock.Of<IRazorViewFactory>();
@ -1176,10 +1179,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
private class OverloadedLocationViewEngine : RazorViewEngine private class OverloadedLocationViewEngine : RazorViewEngine
{ {
public OverloadedLocationViewEngine(IRazorPageFactory pageFactory, public OverloadedLocationViewEngine(
IRazorViewFactory viewFactory, IRazorPageFactory pageFactory,
IOptions<RazorViewEngineOptions> optionsAccessor, IRazorViewFactory viewFactory,
IViewLocationCache cache) IOptions<RazorViewEngineOptions> optionsAccessor,
IViewLocationCache cache)
: base(pageFactory, viewFactory, optionsAccessor, cache) : base(pageFactory, viewFactory, optionsAccessor, cache)
{ {
} }

View File

@ -777,8 +777,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
new HtmlHelperOptions()); new HtmlHelperOptions());
} }
private static TagHelperContext GetTagHelperContext(string id = "testid", private static TagHelperContext GetTagHelperContext(
string childContent = "some child content") string id = "testid",
string childContent = "some child content")
{ {
return new TagHelperContext( return new TagHelperContext(
allAttributes: new TagHelperAttributeList(), allAttributes: new TagHelperAttributeList(),

View File

@ -233,10 +233,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
public class TagHelperOutputContent public class TagHelperOutputContent
{ {
public TagHelperOutputContent(string originalChildContent, public TagHelperOutputContent(
string outputContent, string originalChildContent,
string expectedContent, string outputContent,
string expectedId) string expectedContent,
string expectedId)
{ {
OriginalChildContent = originalChildContent; OriginalChildContent = originalChildContent;
OriginalContent = outputContent; OriginalContent = outputContent;

View File

@ -41,8 +41,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
[Theory] [Theory]
[MemberData(nameof(PasswordWithViewDataAndAttributesData))] [MemberData(nameof(PasswordWithViewDataAndAttributesData))]
public void Password_UsesAttributeValueWhenValueArgumentIsNull(ViewDataDictionary<PasswordModel> vdd, public void Password_UsesAttributeValueWhenValueArgumentIsNull(
object attributes) ViewDataDictionary<PasswordModel> vdd,
object attributes)
{ {
// Arrange // Arrange
var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " + var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " +
@ -58,8 +59,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
[Theory] [Theory]
[MemberData(nameof(PasswordWithViewDataAndAttributesData))] [MemberData(nameof(PasswordWithViewDataAndAttributesData))]
public void Password_UsesExplicitValue_IfSpecified(ViewDataDictionary<PasswordModel> vdd, public void Password_UsesExplicitValue_IfSpecified(
object attributes) ViewDataDictionary<PasswordModel> vdd,
object attributes)
{ {
// Arrange // Arrange
var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " + var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " +
@ -219,8 +221,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
[Theory] [Theory]
[MemberData(nameof(PasswordWithViewDataAndAttributesData))] [MemberData(nameof(PasswordWithViewDataAndAttributesData))]
public void PasswordForWithAttributes_GeneratesExpectedValue(ViewDataDictionary<PasswordModel> vdd, public void PasswordForWithAttributes_GeneratesExpectedValue(
object htmlAttributes) ViewDataDictionary<PasswordModel> vdd,
object htmlAttributes)
{ {
// Arrange // Arrange
var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " + var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " +

View File

@ -137,8 +137,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
[Theory] [Theory]
[MemberData(nameof(IgnoreCaseTestData))] [MemberData(nameof(IgnoreCaseTestData))]
public void AnonymousObjectToHtmlAttributes_IgnoresPropertyCase(object htmlAttributeObject, public void AnonymousObjectToHtmlAttributes_IgnoresPropertyCase(
KeyValuePair<string, object> expectedEntry) object htmlAttributeObject,
KeyValuePair<string, object> expectedEntry)
{ {
// Act // Act
var result = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributeObject); var result = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributeObject);

View File

@ -792,8 +792,9 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
private class TestViewDataDictionary : ViewDataDictionary private class TestViewDataDictionary : ViewDataDictionary
{ {
public TestViewDataDictionary(IModelMetadataProvider modelMetadataProvider, public TestViewDataDictionary(
ModelStateDictionary modelState) IModelMetadataProvider modelMetadataProvider,
ModelStateDictionary modelState)
: base(modelMetadataProvider, modelState) : base(modelMetadataProvider, modelState)
{ {
} }

View File

@ -28,38 +28,56 @@ namespace Microsoft.TestCommon
ExtraDataSets = new List<Tuple<Type, string>>(); ExtraDataSets = new List<Tuple<Type, string>>();
} }
public TestDataSetAttribute(Type declaringType, string propertyName, public TestDataSetAttribute(
Type declaringType1, string propertyName1, Type declaringType,
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All) string propertyName,
Type declaringType1,
string propertyName1,
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
: this(declaringType, propertyName, testDataVariations) : this(declaringType, propertyName, testDataVariations)
{ {
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1) }; ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1) };
} }
public TestDataSetAttribute(Type declaringType, string propertyName, public TestDataSetAttribute(
Type declaringType1, string propertyName1, Type declaringType,
Type declaringType2, string propertyName2, string propertyName,
Type declaringType1,
string propertyName1,
Type declaringType2,
string propertyName2,
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All) TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
: this(declaringType, propertyName, testDataVariations) : this(declaringType, propertyName, testDataVariations)
{ {
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2) }; ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2) };
} }
public TestDataSetAttribute(Type declaringType, string propertyName, public TestDataSetAttribute(
Type declaringType1, string propertyName1, Type declaringType,
Type declaringType2, string propertyName2, string propertyName,
Type declaringType3, string propertyName3, Type declaringType1,
string propertyName1,
Type declaringType2,
string propertyName2,
Type declaringType3,
string propertyName3,
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All) TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
: this(declaringType, propertyName, testDataVariations) : this(declaringType, propertyName, testDataVariations)
{ {
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2), Tuple.Create(declaringType3, propertyName3) }; ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2), Tuple.Create(declaringType3, propertyName3) };
} }
public TestDataSetAttribute(Type declaringType, string propertyName, public TestDataSetAttribute(
Type declaringType1, string propertyName1, Type declaringType,
Type declaringType2, string propertyName2, string propertyName,
Type declaringType3, string propertyName3, Type declaringType1,
Type declaringType4, string propertyName4, string propertyName1,
Type declaringType2,
string propertyName2,
Type declaringType3,
string propertyName3,
Type declaringType4,
string propertyName4,
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All) TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
: this(declaringType, propertyName, testDataVariations) : this(declaringType, propertyName, testDataVariations)
{ {