Fixing StyleCop Issues for issues reported for commit# b58083f73a

This commit is contained in:
harshgMSFT 2014-06-16 13:16:00 -07:00
parent 1bae3bcaa2
commit 170283c724
4 changed files with 14 additions and 14 deletions

View File

@ -346,8 +346,7 @@ namespace Microsoft.AspNet.Mvc
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
Resources.FormatPropertyOfTypeCannotBeNull("ActionDescriptors", Resources.FormatPropertyOfTypeCannotBeNull("ActionDescriptors",
_actionDescriptorsCollectionProvider.GetType() _actionDescriptorsCollectionProvider.GetType()));
));
} }
return descriptors.Items; return descriptors.Items;

View File

@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc
object value; object value;
if (values.TryGetValue(routeKey, out value)) if (values.TryGetValue(routeKey, out value))
{ {
string valueAsString = value as string; var valueAsString = value as string;
if (valueAsString != null) if (valueAsString != null)
{ {
@ -78,8 +78,7 @@ namespace Microsoft.AspNet.Mvc
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
Resources.FormatPropertyOfTypeCannotBeNull("ActionDescriptors", Resources.FormatPropertyOfTypeCannotBeNull("ActionDescriptors",
provider.GetType() provider.GetType()));
));
} }
return descriptors; return descriptors;

View File

@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
public static IServiceProvider CreateServices(string applicationWebSiteName) public static IServiceProvider CreateServices(string applicationWebSiteName)
{ {
var originalProvider = CallContextServiceLocator.Locator.ServiceProvider; var originalProvider = CallContextServiceLocator.Locator.ServiceProvider;
IApplicationEnvironment appEnvironment = originalProvider.GetService<IApplicationEnvironment>(); var appEnvironment = originalProvider.GetService<IApplicationEnvironment>();
// When an application executes in a regular context, the application base path points to the root // When an application executes in a regular context, the application base path points to the root
// directory where the application is located, for example MvcSample.Web. However, when executing // directory where the application is located, for example MvcSample.Web. However, when executing
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
// To compensate for this, we need to calculate the original path and override the application // To compensate for this, we need to calculate the original path and override the application
// environment value so that components like the view engine work properly in the context of the // environment value so that components like the view engine work properly in the context of the
// test. // test.
string appBasePath = CalculateApplicationBasePath(appEnvironment, applicationWebSiteName); var appBasePath = CalculateApplicationBasePath(appEnvironment, applicationWebSiteName);
var provider = new ServiceCollection() var provider = new ServiceCollection()
.AddInstance(typeof(IApplicationEnvironment), .AddInstance(typeof(IApplicationEnvironment),
new TestApplicationEnvironment(appEnvironment, appBasePath)) new TestApplicationEnvironment(appEnvironment, appBasePath))
@ -41,7 +41,8 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
} }
// Calculate the path relative to the application base path. // Calculate the path relative to the application base path.
public static string CalculateApplicationBasePath(IApplicationEnvironment appEnvironment, string applicationWebSiteName) public static string CalculateApplicationBasePath(IApplicationEnvironment appEnvironment,
string applicationWebSiteName)
{ {
// Mvc/test/Microsoft.AspNet.Mvc.FunctionalTests // Mvc/test/Microsoft.AspNet.Mvc.FunctionalTests
var appBase = appEnvironment.ApplicationBasePath; var appBase = appEnvironment.ApplicationBasePath;

View File

@ -41,12 +41,13 @@ namespace InlineConstraints
} }
// Add MVC to the request pipeline // Add MVC to the request pipeline
app.UseMvc(routes=> { app.UseMvc(routes =>
foreach (var item in GetDataFromConfig(config)) {
{ foreach (var item in GetDataFromConfig(config))
routes.MapRoute(item.RouteName, item.RouteTemplateValue); {
} routes.MapRoute(item.RouteName, item.RouteTemplateValue);
}); }
});
} }
private IEnumerable<RouteConfigData> GetDataFromConfig(IConfiguration config) private IEnumerable<RouteConfigData> GetDataFromConfig(IConfiguration config)