Test method is inconclusive: Test wasn’t run. Error?

I have a test class and below I have posted a sample test from the test class namespace AdminPortal.Tests.Controller_Test.Customer { [TestClass] public class BusinessUnitControllerTests { private IBusinessUnitRepository _mockBusinessUnitRepository; private BusinessUnitController _controller; [TestInitialize] public void TestInitialize() { _mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>(); _controller = new BusinessUnitController(_mockBusinessUnitRepository); } [TestCleanup] public void TestCleanup() { _mockBusinessUnitRepository = null; _controller.Dispose(); _controller = … Read more

ASP.NET Bundles how to disable minification

I have debug=”true” in both my web.config(s), and I just don’t want my bundles minified, but nothing I do seems to disable it. I’ve tried enableoptimisations=false, here is my code: //Javascript bundles.Add(new ScriptBundle(“~/bundles/MainJS”) .Include(“~/Scripts/regular/lib/mvc/jquery.validate.unobtrusive.js*”) .Include(“~/Scripts/regular/lib/mvc/jquery.validate*”) .Include(“~/Scripts/regular/lib/bootstrap.js”) .IncludeDirectory(“~/Scripts/regular/modules”, “*.js”, true) .IncludeDirectory(“~/Scripts/regular/pages”, “*.js”, true) .IncludeDirectory(“~/Scripts/regular/misc”, “*.js”, true)); //CSS bundles.Add(new StyleBundle(“~/bundles/MainCSS”) .Include(“~/Content/css/regular/lib/bootstrap.css*”) .IncludeDirectory(“~/Content/css/regular/modules”, “*.css”, true) .IncludeDirectory(“~/Content/css/regular/pages”, “*.css”, true)) … Read more

MVC4 DataType.Date EditorFor won’t display date value in Chrome, fine in Internet Explorer

I’m using the DataType.Date attribute on my model and an EditorFor in my view. This is working fine in Internet Explorer 8 and Internet Explorer 9, but in Google Chrome it is showing a date picker and instead of displaying the value it just displays “Month/Day/Year” in faded gray text. Why won’t Google Chrome display the value? Model: [DataType(DataType.Date)] … Read more

Razor View throwing “The name ‘model’ does not exist in the current context”

After significant refactoring in my MVC 4 application, and Razor shows this error while debugging Views: The name ‘model’ does not exist in the current context. This is the offending line of code: @model ICollection<DataSourceByActive> I know that the usage of @model is correct. Why is this happening? How can I fix it? 25 Answers … Read more

When should I use Async Controllers in ASP.NET MVC?

I have some concerns using async actions in ASP.NET MVC. When does it improve performance of my apps, and when does it not? Is it good to use async action everywhere in ASP.NET MVC? Regarding awaitable methods: shall I use async/await keywords when I want to query a database (via EF/NHibernate/other ORM)? How many times … Read more

Bundler not including .min files

I have a weird issue with the mvc4 bundler not including files with extension .min.js In my BundleConfig class, I declare public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle(“~/Scripts/jquery”) .Include(“~/Scripts/jquery-1.8.0.js”) .Include(“~/Scripts/jquery.tmpl.min.js”)); } In my view, I declare <html> <head> @Scripts.Render(“~/Scripts/jquery”) </head><body>test</body> </html> And when it renders, it only renders <html> <head> <script src=”https://stackoverflow.com/Scripts/jquery-1.8.0.js”></script> </head> <body>test</body> … Read more

How to make custom error pages work in ASP.NET MVC 4

I want a custom error page shown for 500, 404 and 403. Here’s what I have done: Enabled custom errors in the web.config as follows: <customErrors mode=”On” defaultRedirect=”~/Views/Shared/Error.cshtml”> <error statusCode=”403″ redirect=”~/Views/Shared/UnauthorizedAccess.cshtml” /> <error statusCode=”404″ redirect=”~/Views/Shared/FileNotFound.cshtml” /> </customErrors> Registered HandleErrorAttribute as a global action filter in the FilterConfig class as follows: public static void RegisterGlobalFilters(GlobalFilterCollection filters) … Read more