Changes per PR comments
Reformatting parameter identation
This commit is contained in:
parent
a68d9e4cb1
commit
7b433820b1
|
|
@ -13,8 +13,11 @@ using Newtonsoft.Json.Serialization;
|
|||
namespace Microsoft.AspNet.JsonPatch.Converters
|
||||
{
|
||||
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)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
|
|||
// Helper methods to allow case-insensitive key search
|
||||
internal static class ExpandoObjectDictionaryExtensions
|
||||
{
|
||||
internal static void SetValueForCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary,
|
||||
string key, object value)
|
||||
internal static void SetValueForCaseInsensitiveKey(
|
||||
this IDictionary<string, object> propertyDictionary,
|
||||
string key,
|
||||
object value)
|
||||
{
|
||||
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,
|
||||
string key)
|
||||
internal static void RemoveValueForCaseInsensitiveKey(
|
||||
this IDictionary<string, object> propertyDictionary,
|
||||
string key)
|
||||
{
|
||||
string realKey = null;
|
||||
foreach (KeyValuePair<string, object> kvp in propertyDictionary)
|
||||
|
|
@ -40,9 +43,10 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
|
|||
propertyDictionary.Remove(realKey);
|
||||
}
|
||||
}
|
||||
|
||||
internal static object GetValueForCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary,
|
||||
string key)
|
||||
|
||||
internal static object GetValueForCaseInsensitiveKey(
|
||||
this IDictionary<string, object> propertyDictionary,
|
||||
string key)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kvp in propertyDictionary)
|
||||
{
|
||||
|
|
@ -51,12 +55,13 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
|
|||
return kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
throw new ArgumentException(Resources.FormatDictionaryKeyNotFound(key));
|
||||
}
|
||||
|
||||
internal static bool ContainsCaseInsensitiveKey(this IDictionary<string, object> propertyDictionary,
|
||||
string key)
|
||||
|
||||
internal static bool ContainsCaseInsensitiveKey(
|
||||
this IDictionary<string, object> propertyDictionary,
|
||||
string key)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kvp in propertyDictionary)
|
||||
{
|
||||
|
|
@ -65,8 +70,8 @@ namespace Microsoft.AspNet.JsonPatch.Helpers
|
|||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
|
|||
{
|
||||
public class ClientModelValidationContext
|
||||
{
|
||||
public ClientModelValidationContext([NotNull] ModelMetadata metadata,
|
||||
[NotNull] IModelMetadataProvider metadataProvider,
|
||||
[NotNull] IServiceProvider requestServices)
|
||||
public ClientModelValidationContext(
|
||||
[NotNull] ModelMetadata metadata,
|
||||
[NotNull] IModelMetadataProvider metadataProvider,
|
||||
[NotNull] IServiceProvider requestServices)
|
||||
{
|
||||
ModelMetadata = metadata;
|
||||
MetadataProvider = metadataProvider;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
|
|||
{
|
||||
}
|
||||
|
||||
public ModelClientValidationRule([NotNull] string validationType,
|
||||
[NotNull] string errorMessage)
|
||||
public ModelClientValidationRule(
|
||||
[NotNull] string validationType,
|
||||
[NotNull] string errorMessage)
|
||||
{
|
||||
ValidationType = validationType;
|
||||
ErrorMessage = errorMessage;
|
||||
|
|
|
|||
|
|
@ -802,7 +802,8 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
private class MethodToActionMap :
|
||||
Dictionary<MethodInfo, IDictionary<ActionModel, IList<ControllerActionDescriptor>>>
|
||||
{
|
||||
public void AddToMethodInfo(ActionModel action,
|
||||
public void AddToMethodInfo(
|
||||
ActionModel action,
|
||||
IList<ControllerActionDescriptor> actionDescriptors)
|
||||
{
|
||||
IDictionary<ActionModel, IList<ControllerActionDescriptor>> actionsForMethod = null;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,9 @@ namespace Microsoft.AspNet.Mvc.Actions
|
|||
/// <param name="typeInfo">The <see cref="TypeInfo"/>.</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>
|
||||
protected internal virtual bool IsController([NotNull] TypeInfo typeInfo,
|
||||
[NotNull] ISet<Assembly> candidateAssemblies)
|
||||
protected internal virtual bool IsController(
|
||||
[NotNull] TypeInfo typeInfo,
|
||||
[NotNull] ISet<Assembly> candidateAssemblies)
|
||||
{
|
||||
if (!typeInfo.IsClass)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
" Route: {AttributeRouteModel?.Template}, Filters: {Filters.Count}")]
|
||||
public class ActionModel
|
||||
{
|
||||
public ActionModel([NotNull] MethodInfo actionMethod,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
public ActionModel(
|
||||
[NotNull] MethodInfo actionMethod,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ActionMethod = actionMethod;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
" Routes: {AttributeRoutes.Count}, Filters: {Filters.Count}")]
|
||||
public class ControllerModel
|
||||
{
|
||||
public ControllerModel([NotNull] TypeInfo controllerType,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
public ControllerModel(
|
||||
[NotNull] TypeInfo controllerType,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ControllerType = controllerType;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
[DebuggerDisplay("ParameterModel: Name={ParameterName}")]
|
||||
public class ParameterModel
|
||||
{
|
||||
public ParameterModel([NotNull] ParameterInfo parameterInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
public ParameterModel(
|
||||
[NotNull] ParameterInfo parameterInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ParameterInfo = parameterInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// </summary>
|
||||
/// <param name="propertyInfo">The <see cref="PropertyInfo"/> for the underlying property.</param>
|
||||
/// <param name="attributes">Any attributes which are annotated on the property.</param>
|
||||
public PropertyModel([NotNull] PropertyInfo propertyInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
public PropertyModel(
|
||||
[NotNull] PropertyInfo propertyInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
PropertyInfo = propertyInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -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="routeValues">The route data to use for generating the URL.</param>
|
||||
/// <param name="value">The value to format in the entity body.</param>
|
||||
public CreatedAtActionResult(string actionName,
|
||||
string controllerName,
|
||||
object routeValues,
|
||||
object value)
|
||||
public CreatedAtActionResult(
|
||||
string actionName,
|
||||
string controllerName,
|
||||
object routeValues,
|
||||
object value)
|
||||
: base(value)
|
||||
{
|
||||
ActionName = actionName;
|
||||
|
|
|
|||
|
|
@ -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="routeValues">The route data to use for generating the URL.</param>
|
||||
/// <param name="value">The value to format in the entity body.</param>
|
||||
public CreatedAtRouteResult(string routeName,
|
||||
object routeValues,
|
||||
object value)
|
||||
public CreatedAtRouteResult(
|
||||
string routeName,
|
||||
object routeValues,
|
||||
object value)
|
||||
: base(value)
|
||||
{
|
||||
RouteName = routeName;
|
||||
|
|
|
|||
|
|
@ -107,8 +107,12 @@ namespace Microsoft.AspNet.Mvc.Internal
|
|||
}
|
||||
#if DNX451
|
||||
/// <inheritdoc />
|
||||
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count,
|
||||
AsyncCallback callback, object state)
|
||||
public override IAsyncResult BeginRead(
|
||||
byte[] buffer,
|
||||
int offset,
|
||||
int count,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
return _innerStream.BeginRead(buffer, offset, count, callback, state);
|
||||
}
|
||||
|
|
@ -162,8 +166,12 @@ namespace Microsoft.AspNet.Mvc.Internal
|
|||
}
|
||||
#if DNX451
|
||||
/// <inheritdoc />
|
||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count,
|
||||
AsyncCallback callback, object state)
|
||||
public override IAsyncResult BeginWrite(
|
||||
byte[] buffer,
|
||||
int offset,
|
||||
int count,
|
||||
AsyncCallback callback,
|
||||
object state)
|
||||
{
|
||||
return _innerStream.BeginWrite(buffer, offset, count, callback, state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,9 +457,10 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
}
|
||||
|
||||
internal static void ValidateBindingContext(ModelBindingContext bindingContext,
|
||||
Type requiredType,
|
||||
bool allowNullModel)
|
||||
internal static void ValidateBindingContext(
|
||||
ModelBindingContext bindingContext,
|
||||
Type requiredType,
|
||||
bool allowNullModel)
|
||||
{
|
||||
ValidateBindingContext(bindingContext);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
{
|
||||
private RouteValuesCollection _cachedValuesCollection;
|
||||
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
RouteDirection routeDirection)
|
||||
public bool Match(
|
||||
[NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
RouteDirection routeDirection)
|
||||
{
|
||||
object value;
|
||||
if (values.TryGetValue(routeKey, out value))
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
|
|||
/// </summary>
|
||||
public class DataTypeAttributeAdapter : DataAnnotationsClientModelValidator<DataTypeAttribute>
|
||||
{
|
||||
public DataTypeAttributeAdapter(DataTypeAttribute attribute,
|
||||
[NotNull] string ruleName)
|
||||
public DataTypeAttributeAdapter(
|
||||
DataTypeAttribute attribute,
|
||||
[NotNull] string ruleName)
|
||||
: base(attribute)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ruleName))
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
|
|||
private const string EqualToValidationType = "equalto";
|
||||
private const string EqualToValidationParameter = "other";
|
||||
|
||||
public ModelClientValidationEqualToRule([NotNull] string errorMessage,
|
||||
[NotNull] object other)
|
||||
public ModelClientValidationEqualToRule(
|
||||
[NotNull] string errorMessage,
|
||||
[NotNull] object other)
|
||||
: base(EqualToValidationType, errorMessage)
|
||||
{
|
||||
ValidationParameters[EqualToValidationParameter] = other;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation
|
|||
private const string MinValidationParameter = "min";
|
||||
private const string MaxValidationParameter = "max";
|
||||
|
||||
public ModelClientValidationRangeRule([NotNull] string errorMessage,
|
||||
[NotNull] object minValue,
|
||||
[NotNull] object maxValue)
|
||||
public ModelClientValidationRangeRule(
|
||||
[NotNull] string errorMessage,
|
||||
[NotNull] object minValue,
|
||||
[NotNull] object maxValue)
|
||||
: base(RangeValidationType, errorMessage)
|
||||
{
|
||||
ValidationParameters[MinValidationParameter] = minValue;
|
||||
|
|
|
|||
|
|
@ -156,8 +156,9 @@ namespace Microsoft.AspNet.Mvc.Formatters
|
|||
/// </summary>
|
||||
/// <param name="writeStream">The stream on which the XmlWriter should operate on.</param>
|
||||
/// <returns>A new instance of <see cref="XmlWriter"/></returns>
|
||||
public virtual XmlWriter CreateXmlWriter([NotNull] Stream writeStream,
|
||||
[NotNull] XmlWriterSettings xmlWriterSettings)
|
||||
public virtual XmlWriter CreateXmlWriter(
|
||||
[NotNull] Stream writeStream,
|
||||
[NotNull] XmlWriterSettings xmlWriterSettings)
|
||||
{
|
||||
return XmlWriter.Create(
|
||||
new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding),
|
||||
|
|
|
|||
|
|
@ -131,8 +131,9 @@ namespace Microsoft.AspNet.Mvc.Formatters
|
|||
/// </summary>
|
||||
/// <param name="writeStream">The stream on which the XmlWriter should operate on.</param>
|
||||
/// <returns>A new instance of <see cref="XmlWriter"/></returns>
|
||||
public virtual XmlWriter CreateXmlWriter([NotNull] Stream writeStream,
|
||||
[NotNull] XmlWriterSettings xmlWriterSettings)
|
||||
public virtual XmlWriter CreateXmlWriter(
|
||||
[NotNull] Stream writeStream,
|
||||
[NotNull] XmlWriterSettings xmlWriterSettings)
|
||||
{
|
||||
return XmlWriter.Create(
|
||||
new HttpResponseStreamWriter(writeStream, xmlWriterSettings.Encoding),
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Directives
|
|||
}
|
||||
|
||||
// Internal for unit testing
|
||||
internal DefaultChunkTreeCache(IFileProvider fileProvider,
|
||||
MemoryCacheOptions options)
|
||||
internal DefaultChunkTreeCache(
|
||||
IFileProvider fileProvider,
|
||||
MemoryCacheOptions options)
|
||||
{
|
||||
_fileProvider = fileProvider;
|
||||
_chunkTreeCache = new MemoryCache(options);
|
||||
|
|
|
|||
|
|
@ -12,9 +12,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
private readonly string _injectAttribute;
|
||||
|
||||
public InjectChunkVisitor(CSharpCodeWriter writer,
|
||||
CodeGeneratorContext context,
|
||||
string injectAttributeName)
|
||||
public InjectChunkVisitor(
|
||||
CSharpCodeWriter writer,
|
||||
CodeGeneratorContext context,
|
||||
string injectAttributeName)
|
||||
: base(writer, context)
|
||||
{
|
||||
if (writer == null)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
public abstract class MvcCSharpChunkVisitor : CodeVisitor<CSharpCodeWriter>
|
||||
{
|
||||
public MvcCSharpChunkVisitor(CSharpCodeWriter writer,
|
||||
CodeGeneratorContext context)
|
||||
public MvcCSharpChunkVisitor(
|
||||
CSharpCodeWriter writer,
|
||||
CodeGeneratorContext context)
|
||||
: base(writer, context)
|
||||
{
|
||||
if (writer == null)
|
||||
|
|
|
|||
|
|
@ -49,11 +49,6 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
|
|||
IDictionary<string, Type> precompiledViews)
|
||||
: this(fileProvider)
|
||||
{
|
||||
if (fileProvider == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(fileProvider));
|
||||
}
|
||||
|
||||
if (precompiledViews == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(precompiledViews));
|
||||
|
|
|
|||
|
|
@ -331,9 +331,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Precompilation
|
|||
|
||||
private class PrecompileRazorFileInfoCollection : RazorFileInfoCollection
|
||||
{
|
||||
public PrecompileRazorFileInfoCollection(string assemblyResourceName,
|
||||
string symbolsResourceName,
|
||||
IReadOnlyList<RazorFileInfo> fileInfos)
|
||||
public PrecompileRazorFileInfoCollection(
|
||||
string assemblyResourceName,
|
||||
string symbolsResourceName,
|
||||
IReadOnlyList<RazorFileInfo> fileInfos)
|
||||
{
|
||||
AssemblyResourceName = assemblyResourceName;
|
||||
SymbolsResourceName = symbolsResourceName;
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
/// pages</param>
|
||||
public RazorView(
|
||||
IRazorViewEngine viewEngine,
|
||||
IRazorPageActivator pageActivator,
|
||||
IViewStartProvider viewStartProvider,
|
||||
IRazorPage razorPage,
|
||||
IHtmlEncoder htmlEncoder,
|
||||
bool isPartial)
|
||||
IRazorPageActivator pageActivator,
|
||||
IViewStartProvider viewStartProvider,
|
||||
IRazorPage razorPage,
|
||||
IHtmlEncoder htmlEncoder,
|
||||
bool isPartial)
|
||||
{
|
||||
_viewEngine = viewEngine;
|
||||
_pageActivator = pageActivator;
|
||||
|
|
@ -81,11 +81,6 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
_pageExecutionFeature = context.HttpContext.Features.Get<IPageExecutionListenerFeature>();
|
||||
|
||||
// Partials don't execute _ViewStart pages, but may execute Layout pages if the Layout property
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
}
|
||||
|
||||
private static void ConfigureRazor(RazorViewEngineOptions razorOptions,
|
||||
IApplicationEnvironment applicationEnvironment)
|
||||
private static void ConfigureRazor(
|
||||
RazorViewEngineOptions razorOptions,
|
||||
IApplicationEnvironment applicationEnvironment)
|
||||
{
|
||||
razorOptions.FileProvider = new PhysicalFileProvider(applicationEnvironment.ApplicationBasePath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,6 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
throw new ArgumentNullException(nameof(foundLocation));
|
||||
}
|
||||
|
||||
if (searchedLocations == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(searchedLocations));
|
||||
}
|
||||
|
||||
ViewLocation = foundLocation;
|
||||
SearchedLocations = searchedLocations;
|
||||
IsFoundResult = true;
|
||||
|
|
|
|||
|
|
@ -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="viewName">The view name.</param>
|
||||
/// <param name="isPartial">Determines if the view being discovered is a partial.</param>
|
||||
public ViewLocationExpanderContext(ActionContext actionContext,
|
||||
string viewName,
|
||||
bool isPartial)
|
||||
public ViewLocationExpanderContext(
|
||||
ActionContext actionContext,
|
||||
string viewName,
|
||||
bool isPartial)
|
||||
{
|
||||
if (actionContext == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -237,10 +237,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
return options;
|
||||
}
|
||||
|
||||
private static void AddStringCollectionKey(StringBuilder builder,
|
||||
string keyName,
|
||||
string value,
|
||||
IReadableStringCollection sourceCollection)
|
||||
private static void AddStringCollectionKey(
|
||||
StringBuilder builder,
|
||||
string keyName,
|
||||
string value,
|
||||
IReadableStringCollection sourceCollection)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -570,8 +570,10 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="routeValues">The parameters for a route.</param>
|
||||
/// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns>
|
||||
[NonAction]
|
||||
public virtual RedirectToActionResult RedirectToAction(string actionName, string controllerName,
|
||||
object routeValues)
|
||||
public virtual RedirectToActionResult RedirectToAction(
|
||||
string actionName,
|
||||
string controllerName,
|
||||
object 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>
|
||||
/// <returns>The created <see cref="RedirectToActionResult"/> for the response.</returns>
|
||||
[NonAction]
|
||||
public virtual RedirectToActionResult RedirectToActionPermanent(string actionName, string controllerName,
|
||||
object routeValues)
|
||||
public virtual RedirectToActionResult RedirectToActionPermanent(
|
||||
string actionName,
|
||||
string controllerName,
|
||||
object routeValues)
|
||||
{
|
||||
return new RedirectToActionResult(
|
||||
actionName,
|
||||
|
|
@ -984,10 +988,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="value">The content value to format in the entity body.</param>
|
||||
/// <returns>The created <see cref="CreatedAtRouteResult"/> for the response.</returns>
|
||||
[NonAction]
|
||||
public virtual CreatedAtActionResult CreatedAtAction(string actionName,
|
||||
string controllerName,
|
||||
object routeValues,
|
||||
object value)
|
||||
public virtual CreatedAtActionResult CreatedAtAction(
|
||||
string actionName,
|
||||
string controllerName,
|
||||
object routeValues,
|
||||
object value)
|
||||
{
|
||||
var disposableValue = value as IDisposable;
|
||||
if (disposableValue != null)
|
||||
|
|
@ -1419,7 +1424,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <returns><c>true</c> if the <see cref="ModelState"/> is valid;<c>false</c> otherwise.</returns>
|
||||
[NonAction]
|
||||
public virtual bool TryValidateModel(
|
||||
[NotNull] object model,
|
||||
[NotNull] object model,
|
||||
string prefix)
|
||||
{
|
||||
if (BindingContext == null)
|
||||
|
|
|
|||
|
|
@ -24,22 +24,25 @@ namespace Microsoft.AspNet.Mvc.ViewEngines
|
|||
public IReadOnlyList<IViewEngine> ViewEngines { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ViewEngineResult FindPartialView([NotNull] ActionContext context,
|
||||
[NotNull] string partialViewName)
|
||||
public ViewEngineResult FindPartialView(
|
||||
[NotNull] ActionContext context,
|
||||
[NotNull] string partialViewName)
|
||||
{
|
||||
return FindView(context, partialViewName, partial: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ViewEngineResult FindView([NotNull] ActionContext context,
|
||||
[NotNull] string viewName)
|
||||
public ViewEngineResult FindView(
|
||||
[NotNull] ActionContext context,
|
||||
[NotNull] string viewName)
|
||||
{
|
||||
return FindView(context, viewName, partial: false);
|
||||
}
|
||||
|
||||
private ViewEngineResult FindView(ActionContext context,
|
||||
string viewName,
|
||||
bool partial)
|
||||
private ViewEngineResult FindView(
|
||||
ActionContext context,
|
||||
string viewName,
|
||||
bool partial)
|
||||
{
|
||||
var searchedLocations = Enumerable.Empty<string>();
|
||||
foreach (var engine in ViewEngines)
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ namespace Microsoft.AspNet.Mvc.ViewEngines
|
|||
get { return View != null; }
|
||||
}
|
||||
|
||||
public static ViewEngineResult NotFound([NotNull] string viewName,
|
||||
[NotNull] IEnumerable<string> searchedLocations)
|
||||
public static ViewEngineResult NotFound(
|
||||
[NotNull] string viewName,
|
||||
[NotNull] IEnumerable<string> searchedLocations)
|
||||
{
|
||||
return new ViewEngineResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -283,10 +283,11 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IHtmlContent Display(string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
object additionalViewData)
|
||||
public IHtmlContent Display(
|
||||
string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
object additionalViewData)
|
||||
{
|
||||
var metadata = ExpressionMetadataProvider.FromStringExpression(expression, ViewData, MetadataProvider);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,15 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
|
|||
private bool _readOnly;
|
||||
private object _additionalViewData;
|
||||
|
||||
public TemplateBuilder([NotNull] IViewEngine viewEngine,
|
||||
[NotNull] ViewContext viewContext,
|
||||
[NotNull] ViewDataDictionary viewData,
|
||||
[NotNull] ModelExplorer modelExplorer,
|
||||
string htmlFieldName,
|
||||
string templateName,
|
||||
bool readOnly,
|
||||
object additionalViewData)
|
||||
public TemplateBuilder(
|
||||
[NotNull] IViewEngine viewEngine,
|
||||
[NotNull] ViewContext viewContext,
|
||||
[NotNull] ViewDataDictionary viewData,
|
||||
[NotNull] ModelExplorer modelExplorer,
|
||||
string htmlFieldName,
|
||||
string templateName,
|
||||
bool readOnly,
|
||||
object additionalViewData)
|
||||
{
|
||||
_viewEngine = viewEngine;
|
||||
_viewContext = viewContext;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,10 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
|||
return results;
|
||||
}
|
||||
|
||||
private static void ValidateUnobtrusiveValidationRule(ModelClientValidationRule rule,
|
||||
IDictionary<string, object> resultsDictionary, string dictionaryKey)
|
||||
private static void ValidateUnobtrusiveValidationRule(
|
||||
ModelClientValidationRule rule,
|
||||
IDictionary<string, object> resultsDictionary,
|
||||
string dictionaryKey)
|
||||
{
|
||||
if (string.IsNullOrEmpty(rule.ValidationType))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
|||
/// </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>
|
||||
public ViewDataDictionary([NotNull] IModelMetadataProvider metadataProvider,
|
||||
[NotNull] ModelStateDictionary modelState)
|
||||
public ViewDataDictionary(
|
||||
[NotNull] IModelMetadataProvider metadataProvider,
|
||||
[NotNull] ModelStateDictionary modelState)
|
||||
: this(metadataProvider, modelState, declaredModelType: typeof(object))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,13 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
|||
/// <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>
|
||||
/// <returns>A <see cref="Task"/> that represents the asynchronous rendering.</returns>
|
||||
public static async Task ExecuteAsync([NotNull] IView view,
|
||||
[NotNull] ActionContext actionContext,
|
||||
[NotNull] ViewDataDictionary viewData,
|
||||
[NotNull] ITempDataDictionary tempData,
|
||||
[NotNull] HtmlHelperOptions htmlHelperOptions,
|
||||
MediaTypeHeaderValue contentType)
|
||||
public static async Task ExecuteAsync(
|
||||
[NotNull] IView view,
|
||||
[NotNull] ActionContext actionContext,
|
||||
[NotNull] ViewDataDictionary viewData,
|
||||
[NotNull] ITempDataDictionary tempData,
|
||||
[NotNull] HtmlHelperOptions htmlHelperOptions,
|
||||
MediaTypeHeaderValue contentType)
|
||||
{
|
||||
var response = actionContext.HttpContext.Response;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ namespace System.Net.Http.Formatting
|
|||
/// <param name="stringWithQuality1">The first value to compare.</param>
|
||||
/// <param name="stringWithQuality2">The second value to compare</param>
|
||||
/// <returns>The result of the comparison.</returns>
|
||||
public int Compare(StringWithQualityHeaderValue stringWithQuality1,
|
||||
StringWithQualityHeaderValue stringWithQuality2)
|
||||
public int Compare(
|
||||
StringWithQualityHeaderValue stringWithQuality1,
|
||||
StringWithQualityHeaderValue stringWithQuality2)
|
||||
{
|
||||
Debug.Assert(stringWithQuality1 != null);
|
||||
Debug.Assert(stringWithQuality2 != null);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,11 @@ namespace Microsoft.AspNet.Mvc.Formatters
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(OutputFormatterContextValues_CanWriteType))]
|
||||
public void CanWriteResult_ByDefault_ReturnsTrue_IfTheValueIsNull(object value,
|
||||
bool declaredTypeAsString,
|
||||
bool expectedCanwriteResult,
|
||||
bool useNonNullContentType)
|
||||
public void CanWriteResult_ByDefault_ReturnsTrue_IfTheValueIsNull(
|
||||
object value,
|
||||
bool declaredTypeAsString,
|
||||
bool expectedCanwriteResult,
|
||||
bool useNonNullContentType)
|
||||
{
|
||||
// Arrange
|
||||
var typeToUse = declaredTypeAsString ? typeof(string) : typeof(object);
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ namespace Microsoft.AspNet.Mvc.Formatters
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(SelectResponseCharacterEncodingData))]
|
||||
public void SelectResponseCharacterEncoding_SelectsEncoding(string acceptCharsetHeaders,
|
||||
string requestEncoding,
|
||||
string[] supportedEncodings,
|
||||
string expectedEncoding)
|
||||
public void SelectResponseCharacterEncoding_SelectsEncoding(
|
||||
string acceptCharsetHeaders,
|
||||
string requestEncoding,
|
||||
string[] supportedEncodings,
|
||||
string expectedEncoding)
|
||||
{
|
||||
// Arrange
|
||||
var mockHttpContext = new Mock<HttpContext>();
|
||||
|
|
|
|||
|
|
@ -45,9 +45,10 @@ namespace Microsoft.AspNet.Mvc
|
|||
[Theory]
|
||||
[InlineData("", "/Home/About", "/Home/About")]
|
||||
[InlineData("/myapproot", "/test", "/test")]
|
||||
public void Execute_ReturnsContentPath_WhenItDoesNotStartWithTilde(string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
public void Execute_ReturnsContentPath_WhenItDoesNotStartWithTilde(
|
||||
string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
{
|
||||
// Arrange
|
||||
var httpResponse = new Mock<HttpResponse>();
|
||||
|
|
@ -72,9 +73,10 @@ namespace Microsoft.AspNet.Mvc
|
|||
[InlineData("/", "~/", "/")]
|
||||
[InlineData("", "~/Home/About", "/Home/About")]
|
||||
[InlineData("/myapproot", "~/", "/myapproot/")]
|
||||
public void Execute_ReturnsAppRelativePath_WhenItStartsWithTilde(string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
public void Execute_ReturnsAppRelativePath_WhenItStartsWithTilde(
|
||||
string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
{
|
||||
// Arrange
|
||||
var httpResponse = new Mock<HttpResponse>();
|
||||
|
|
@ -110,10 +112,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
return serviceCollection.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private static HttpContext GetHttpContext(string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath,
|
||||
HttpResponse response)
|
||||
private static HttpContext GetHttpContext(
|
||||
string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath,
|
||||
HttpResponse response)
|
||||
{
|
||||
var httpContext = new Mock<HttpContext>();
|
||||
var actionContext = GetActionContext(httpContext.Object);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
[InlineData("/myapproot", null, null)]
|
||||
[InlineData("", "/Home/About", "/Home/About")]
|
||||
[InlineData("/myapproot", "/test", "/test")]
|
||||
public void Content_ReturnsContentPath_WhenItDoesNotStartWithToken(string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
public void Content_ReturnsContentPath_WhenItDoesNotStartWithToken(
|
||||
string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
{
|
||||
// Arrange
|
||||
var context = CreateHttpContext(GetServices(), appRoot);
|
||||
|
|
@ -49,9 +50,10 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
[InlineData("", "~/Home/About", "/Home/About")]
|
||||
[InlineData("/", "~", "/")]
|
||||
[InlineData("/myapproot", "~/Content/bootstrap.css", "/myapproot/Content/bootstrap.css")]
|
||||
public void Content_ReturnsAppRelativePath_WhenItStartsWithToken(string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
public void Content_ReturnsAppRelativePath_WhenItStartsWithToken(
|
||||
string appRoot,
|
||||
string contentPath,
|
||||
string expectedPath)
|
||||
{
|
||||
// Arrange
|
||||
var context = CreateHttpContext(GetServices(), appRoot);
|
||||
|
|
|
|||
|
|
@ -598,7 +598,9 @@ namespace Microsoft.AspNet.Mvc.Formatters.Xml
|
|||
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")
|
||||
{
|
||||
return new OutputFormatterContext
|
||||
|
|
|
|||
|
|
@ -64,8 +64,9 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
[InlineData("Foo?", "Foo?")]
|
||||
[InlineData("Foo[[]][]", "Foo[[]][]")]
|
||||
[InlineData("$rootnamespace$.MyModel", "$rootnamespace$.MyModel")]
|
||||
public void ParseModelKeyword_InfersBaseType_FromModelName(string modelName,
|
||||
string expectedModel)
|
||||
public void ParseModelKeyword_InfersBaseType_FromModelName(
|
||||
string modelName,
|
||||
string expectedModel)
|
||||
{
|
||||
// Arrange
|
||||
var documentContent = "@model " + modelName + Environment.NewLine + "Bar";
|
||||
|
|
@ -270,9 +271,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
[InlineData(" Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?> MyHelper ",
|
||||
"Microsoft.AspNet.Mvc.IHtmlHelper<MyNullableModel[]?>", "MyHelper")]
|
||||
[InlineData(" TestService @class ", "TestService", "@class")]
|
||||
public void ParseInjectKeyword_InfersTypeAndPropertyName(string injectStatement,
|
||||
string expectedService,
|
||||
string expectedPropertyName)
|
||||
public void ParseInjectKeyword_InfersTypeAndPropertyName(
|
||||
string injectStatement,
|
||||
string expectedService,
|
||||
string expectedPropertyName)
|
||||
{
|
||||
// Arrange
|
||||
var documentContent = "@inject " + injectStatement;
|
||||
|
|
@ -348,9 +350,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
[Theory]
|
||||
[InlineData("IMyService Service ", "IMyService", "Service")]
|
||||
[InlineData(" TestService @namespace ", "TestService", "@namespace")]
|
||||
public void ParseInjectKeyword_ParsesUpToNewLine(string injectStatement,
|
||||
string expectedService,
|
||||
string expectedPropertyName)
|
||||
public void ParseInjectKeyword_ParsesUpToNewLine(
|
||||
string injectStatement,
|
||||
string expectedService,
|
||||
string expectedPropertyName)
|
||||
{
|
||||
// Arrange
|
||||
var documentContent = "@inject " + injectStatement + Environment.NewLine + "Bar";
|
||||
|
|
@ -514,9 +517,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
Assert.Equal(expectedErrors, errors);
|
||||
}
|
||||
|
||||
private static List<Span> ParseDocument(string documentContents,
|
||||
List<RazorError> errors = null,
|
||||
List<LineMapping> lineMappings = null)
|
||||
private static List<Span> ParseDocument(
|
||||
string documentContents,
|
||||
List<RazorError> errors = null,
|
||||
List<LineMapping> lineMappings = null)
|
||||
{
|
||||
errors = errors ?? new List<RazorError>();
|
||||
var markupParser = new HtmlMarkupParser();
|
||||
|
|
|
|||
|
|
@ -234,9 +234,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
|
||||
private class TestableMvcRazorParser : MvcRazorParser
|
||||
{
|
||||
public TestableMvcRazorParser(RazorParser parser,
|
||||
IReadOnlyList<ChunkTree> chunkTrees,
|
||||
IReadOnlyList<Chunk> defaultInheritedChunks)
|
||||
public TestableMvcRazorParser(
|
||||
RazorParser parser,
|
||||
IReadOnlyList<ChunkTree> chunkTrees,
|
||||
IReadOnlyList<Chunk> defaultInheritedChunks)
|
||||
: base(parser, chunkTrees, defaultInheritedChunks, typeof(ModelExpression).FullName)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
[Theory]
|
||||
[InlineData("SomeType", "SomeType", "SomeMethod(__model => __model.MyValue)")]
|
||||
[InlineData("SomeType", "SomeType2", "MyValue")]
|
||||
public void RenderAttributeValue_RendersModelExpressionsCorrectly(string modelExpressionType,
|
||||
string propertyType,
|
||||
string expectedValue)
|
||||
public void RenderAttributeValue_RendersModelExpressionsCorrectly(
|
||||
string modelExpressionType,
|
||||
string propertyType,
|
||||
string expectedValue)
|
||||
{
|
||||
// Arrange
|
||||
var renderer = new MvcTagHelperAttributeValueCodeRenderer(
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
p.WriteAttribute("href",
|
||||
new PositionTagged<string>("prefix", 0),
|
||||
new PositionTagged<string>("suffix", 10),
|
||||
new AttributeValue(new PositionTagged<string>("", 6),
|
||||
new AttributeValue(new PositionTagged<string>(string.Empty, 6),
|
||||
new PositionTagged<object>("true", 6),
|
||||
literal: false));
|
||||
});
|
||||
|
|
@ -756,7 +756,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
new AttributeValue[] {
|
||||
new AttributeValue(
|
||||
new PositionTagged<string>("", 9),
|
||||
new PositionTagged<string>(string.Empty, 9),
|
||||
new PositionTagged<object>("Hello", 9),
|
||||
literal: true)
|
||||
},
|
||||
|
|
@ -778,7 +778,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
new PositionTagged<object>(null, 10),
|
||||
literal: false)
|
||||
},
|
||||
""
|
||||
string.Empty
|
||||
},
|
||||
{
|
||||
new AttributeValue[] {
|
||||
|
|
@ -806,7 +806,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
new AttributeValue[] {
|
||||
new AttributeValue(
|
||||
new PositionTagged<string>("", 9),
|
||||
new PositionTagged<string>(string.Empty, 9),
|
||||
new PositionTagged<object>("prefix", 9),
|
||||
literal: true),
|
||||
new AttributeValue(
|
||||
|
|
@ -859,7 +859,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, "")]
|
||||
[InlineData(null, string.Empty)]
|
||||
[InlineData(false, "False")]
|
||||
public void AddHtmlAttributeValues_OnlyAddsToAllAttributesWhenAttributeRemoved(
|
||||
object attributeValue,
|
||||
|
|
@ -939,7 +939,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
new AttributeValue[] {
|
||||
new AttributeValue(
|
||||
new PositionTagged<string>("", 9),
|
||||
new PositionTagged<string>(string.Empty, 9),
|
||||
new PositionTagged<object>(true, 9),
|
||||
literal: false)
|
||||
},
|
||||
|
|
@ -948,20 +948,20 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
new AttributeValue[] {
|
||||
new AttributeValue(
|
||||
new PositionTagged<string>("", 9),
|
||||
new PositionTagged<string>(string.Empty, 9),
|
||||
new PositionTagged<object>(false, 9),
|
||||
literal: false)
|
||||
},
|
||||
""
|
||||
string.Empty
|
||||
},
|
||||
{
|
||||
new AttributeValue[] {
|
||||
new AttributeValue(
|
||||
new PositionTagged<string>("", 9),
|
||||
new PositionTagged<string>(string.Empty, 9),
|
||||
new PositionTagged<object>(null, 9),
|
||||
literal: false)
|
||||
},
|
||||
""
|
||||
string.Empty
|
||||
},
|
||||
{
|
||||
new AttributeValue[] {
|
||||
|
|
@ -1007,7 +1007,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
page.HtmlEncoder = new CommonTestEncoder();
|
||||
var writer = new StringWriter();
|
||||
var prefix = new PositionTagged<string>("someattr=", 0);
|
||||
var suffix = new PositionTagged<string>("", 0);
|
||||
var suffix = new PositionTagged<string>(string.Empty, 0);
|
||||
|
||||
// Act
|
||||
page.WriteAttributeTo(writer, "someattr", prefix, suffix, attributeValues);
|
||||
|
|
@ -1059,7 +1059,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.StartTagAndEndTag,
|
||||
preElement: null,
|
||||
|
|
@ -1358,7 +1358,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.StartTagAndEndTag,
|
||||
preElement: "Before",
|
||||
|
|
@ -1370,7 +1370,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList { { "test", "testVal" } },
|
||||
tagMode: TagMode.SelfClosing,
|
||||
preElement: "Before",
|
||||
|
|
@ -1406,7 +1406,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList { { "test", "testVal" } },
|
||||
tagMode: TagMode.StartTagOnly,
|
||||
preElement: "Before",
|
||||
|
|
@ -1454,7 +1454,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.StartTagAndEndTag,
|
||||
preElement: null,
|
||||
|
|
@ -1466,7 +1466,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList { { "test", "testVal" } },
|
||||
tagMode: TagMode.SelfClosing,
|
||||
preElement: null,
|
||||
|
|
@ -1502,7 +1502,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList { { "test", "testVal" } },
|
||||
tagMode: TagMode.StartTagOnly,
|
||||
preElement: null,
|
||||
|
|
@ -1574,7 +1574,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.SelfClosing,
|
||||
preElement: "Before",
|
||||
|
|
@ -1598,7 +1598,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.StartTagOnly,
|
||||
preElement: "Before",
|
||||
|
|
@ -1610,7 +1610,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList(),
|
||||
tagMode: TagMode.StartTagAndEndTag,
|
||||
preElement: "Before",
|
||||
|
|
@ -1622,7 +1622,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
},
|
||||
{
|
||||
GetTagHelperOutput(
|
||||
tagName: "",
|
||||
tagName: string.Empty,
|
||||
attributes: new TagHelperAttributeList { { "test", "testVal" } },
|
||||
tagMode: TagMode.StartTagAndEndTag,
|
||||
preElement: "Before",
|
||||
|
|
|
|||
|
|
@ -338,8 +338,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(ViewLocationExpanderTestData))]
|
||||
public void FindView_UsesViewLocationExpandersToLocateViews(IDictionary<string, object> routeValues,
|
||||
IEnumerable<string> expectedSeeds)
|
||||
public void FindView_UsesViewLocationExpandersToLocateViews(
|
||||
IDictionary<string, object> routeValues,
|
||||
IEnumerable<string> expectedSeeds)
|
||||
{
|
||||
// Arrange
|
||||
var pageFactory = new Mock<IRazorPageFactory>();
|
||||
|
|
@ -589,8 +590,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(ViewLocationExpanderTestData))]
|
||||
public void FindPage_UsesViewLocationExpander_ToExpandPaths(IDictionary<string, object> routeValues,
|
||||
IEnumerable<string> expectedSeeds)
|
||||
public void FindPage_UsesViewLocationExpander_ToExpandPaths(
|
||||
IDictionary<string, object> routeValues,
|
||||
IEnumerable<string> expectedSeeds)
|
||||
{
|
||||
// Arrange
|
||||
var page = Mock.Of<IRazorPage>();
|
||||
|
|
@ -1082,10 +1084,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
|
|||
}
|
||||
}
|
||||
|
||||
private RazorViewEngine CreateViewEngine(IRazorPageFactory pageFactory = null,
|
||||
IRazorViewFactory viewFactory = null,
|
||||
IEnumerable<IViewLocationExpander> expanders = null,
|
||||
IViewLocationCache cache = null)
|
||||
private RazorViewEngine CreateViewEngine(
|
||||
IRazorPageFactory pageFactory = null,
|
||||
IRazorViewFactory viewFactory = null,
|
||||
IEnumerable<IViewLocationExpander> expanders = null,
|
||||
IViewLocationCache cache = null)
|
||||
{
|
||||
pageFactory = pageFactory ?? Mock.Of<IRazorPageFactory>();
|
||||
viewFactory = viewFactory ?? Mock.Of<IRazorViewFactory>();
|
||||
|
|
@ -1176,10 +1179,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
|
|||
|
||||
private class OverloadedLocationViewEngine : RazorViewEngine
|
||||
{
|
||||
public OverloadedLocationViewEngine(IRazorPageFactory pageFactory,
|
||||
IRazorViewFactory viewFactory,
|
||||
IOptions<RazorViewEngineOptions> optionsAccessor,
|
||||
IViewLocationCache cache)
|
||||
public OverloadedLocationViewEngine(
|
||||
IRazorPageFactory pageFactory,
|
||||
IRazorViewFactory viewFactory,
|
||||
IOptions<RazorViewEngineOptions> optionsAccessor,
|
||||
IViewLocationCache cache)
|
||||
: base(pageFactory, viewFactory, optionsAccessor, cache)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -777,8 +777,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
new HtmlHelperOptions());
|
||||
}
|
||||
|
||||
private static TagHelperContext GetTagHelperContext(string id = "testid",
|
||||
string childContent = "some child content")
|
||||
private static TagHelperContext GetTagHelperContext(
|
||||
string id = "testid",
|
||||
string childContent = "some child content")
|
||||
{
|
||||
return new TagHelperContext(
|
||||
allAttributes: new TagHelperAttributeList(),
|
||||
|
|
|
|||
|
|
@ -233,10 +233,11 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
public class TagHelperOutputContent
|
||||
{
|
||||
public TagHelperOutputContent(string originalChildContent,
|
||||
string outputContent,
|
||||
string expectedContent,
|
||||
string expectedId)
|
||||
public TagHelperOutputContent(
|
||||
string originalChildContent,
|
||||
string outputContent,
|
||||
string expectedContent,
|
||||
string expectedId)
|
||||
{
|
||||
OriginalChildContent = originalChildContent;
|
||||
OriginalContent = outputContent;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(PasswordWithViewDataAndAttributesData))]
|
||||
public void Password_UsesAttributeValueWhenValueArgumentIsNull(ViewDataDictionary<PasswordModel> vdd,
|
||||
object attributes)
|
||||
public void Password_UsesAttributeValueWhenValueArgumentIsNull(
|
||||
ViewDataDictionary<PasswordModel> vdd,
|
||||
object attributes)
|
||||
{
|
||||
// Arrange
|
||||
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]
|
||||
[MemberData(nameof(PasswordWithViewDataAndAttributesData))]
|
||||
public void Password_UsesExplicitValue_IfSpecified(ViewDataDictionary<PasswordModel> vdd,
|
||||
object attributes)
|
||||
public void Password_UsesExplicitValue_IfSpecified(
|
||||
ViewDataDictionary<PasswordModel> vdd,
|
||||
object attributes)
|
||||
{
|
||||
// Arrange
|
||||
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]
|
||||
[MemberData(nameof(PasswordWithViewDataAndAttributesData))]
|
||||
public void PasswordForWithAttributes_GeneratesExpectedValue(ViewDataDictionary<PasswordModel> vdd,
|
||||
object htmlAttributes)
|
||||
public void PasswordForWithAttributes_GeneratesExpectedValue(
|
||||
ViewDataDictionary<PasswordModel> vdd,
|
||||
object htmlAttributes)
|
||||
{
|
||||
// Arrange
|
||||
var expected = @"<input id=""HtmlEncode[[Property1]]"" name=""HtmlEncode[[Property1]]"" test-key=""HtmlEncode[[test-value]]"" type=""HtmlEncode[[password]]"" " +
|
||||
|
|
|
|||
|
|
@ -137,8 +137,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
[Theory]
|
||||
[MemberData(nameof(IgnoreCaseTestData))]
|
||||
public void AnonymousObjectToHtmlAttributes_IgnoresPropertyCase(object htmlAttributeObject,
|
||||
KeyValuePair<string, object> expectedEntry)
|
||||
public void AnonymousObjectToHtmlAttributes_IgnoresPropertyCase(
|
||||
object htmlAttributeObject,
|
||||
KeyValuePair<string, object> expectedEntry)
|
||||
{
|
||||
// Act
|
||||
var result = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributeObject);
|
||||
|
|
|
|||
|
|
@ -792,8 +792,9 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
|||
|
||||
private class TestViewDataDictionary : ViewDataDictionary
|
||||
{
|
||||
public TestViewDataDictionary(IModelMetadataProvider modelMetadataProvider,
|
||||
ModelStateDictionary modelState)
|
||||
public TestViewDataDictionary(
|
||||
IModelMetadataProvider modelMetadataProvider,
|
||||
ModelStateDictionary modelState)
|
||||
: base(modelMetadataProvider, modelState)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,38 +28,56 @@ namespace Microsoft.TestCommon
|
|||
ExtraDataSets = new List<Tuple<Type, string>>();
|
||||
}
|
||||
|
||||
public TestDataSetAttribute(Type declaringType, string propertyName,
|
||||
Type declaringType1, string propertyName1,
|
||||
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
|
||||
public TestDataSetAttribute(
|
||||
Type declaringType,
|
||||
string propertyName,
|
||||
Type declaringType1,
|
||||
string propertyName1,
|
||||
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
|
||||
: this(declaringType, propertyName, testDataVariations)
|
||||
{
|
||||
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1) };
|
||||
}
|
||||
|
||||
public TestDataSetAttribute(Type declaringType, string propertyName,
|
||||
Type declaringType1, string propertyName1,
|
||||
Type declaringType2, string propertyName2,
|
||||
public TestDataSetAttribute(
|
||||
Type declaringType,
|
||||
string propertyName,
|
||||
Type declaringType1,
|
||||
string propertyName1,
|
||||
Type declaringType2,
|
||||
string propertyName2,
|
||||
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
|
||||
: this(declaringType, propertyName, testDataVariations)
|
||||
{
|
||||
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2) };
|
||||
}
|
||||
|
||||
public TestDataSetAttribute(Type declaringType, string propertyName,
|
||||
Type declaringType1, string propertyName1,
|
||||
Type declaringType2, string propertyName2,
|
||||
Type declaringType3, string propertyName3,
|
||||
public TestDataSetAttribute(
|
||||
Type declaringType,
|
||||
string propertyName,
|
||||
Type declaringType1,
|
||||
string propertyName1,
|
||||
Type declaringType2,
|
||||
string propertyName2,
|
||||
Type declaringType3,
|
||||
string propertyName3,
|
||||
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
|
||||
: this(declaringType, propertyName, testDataVariations)
|
||||
{
|
||||
ExtraDataSets = new List<Tuple<Type, string>> { Tuple.Create(declaringType1, propertyName1), Tuple.Create(declaringType2, propertyName2), Tuple.Create(declaringType3, propertyName3) };
|
||||
}
|
||||
|
||||
public TestDataSetAttribute(Type declaringType, string propertyName,
|
||||
Type declaringType1, string propertyName1,
|
||||
Type declaringType2, string propertyName2,
|
||||
Type declaringType3, string propertyName3,
|
||||
Type declaringType4, string propertyName4,
|
||||
public TestDataSetAttribute(
|
||||
Type declaringType,
|
||||
string propertyName,
|
||||
Type declaringType1,
|
||||
string propertyName1,
|
||||
Type declaringType2,
|
||||
string propertyName2,
|
||||
Type declaringType3,
|
||||
string propertyName3,
|
||||
Type declaringType4,
|
||||
string propertyName4,
|
||||
TestDataVariations testDataVariations = TestCommon.TestDataVariations.All)
|
||||
: this(declaringType, propertyName, testDataVariations)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue