Failure is inevitable


Using Inversion of Control with the Default ASP.NET MVC App Template

I routinely get questions about using an IoC container, like StructureMap, with ASP.NET Identity, particularly with the way it’s set up in the default ASP.NET MVC project template.  In this post, I’ll show you the quickest way to IoC-enable the starter app. More...

SpecsFor.Mvc and SpecsFor<Web> Helpers updated!

There are two new releases on the SpecsFor front today.  First, thanks to Neuhoffm again, SpecsFor.Mvc now supports radio buttons properly.  You can “check” a radio button by string value or by using a strongly-typed value: SUT.FindFormFor<Task>() .Field(m => m.Title).SetValueTo("use radio buttons") //By string... .Field(m => m.Complete, "false").Click() .Submit(); SUT.FindFormFor<Task>() .Field(m => m.Title).SetValueTo("use radio buttons") .Field(m => m.Complete, true).Click() //Or b... [More]

Random Link Roundup–2/6/2015

It’s Friday again already!  I only have a small collection of links this week, but hey, at least I posted something! More...

The 10 AngularJS Directives I Use the Most

AngularJS has a TON of directives.  Here's a quick list of 10 built-in AngularJS directives that I find myself using more often than any others. More...

SpecsFor.Mvc 4.2.0 Released!

There’s a new build of SpecsFor.Mvc available on NuGet tonight!  This version adds support for navigating to controllers within areas that are decorated with the RouteAreaAttribute class.  Now you can do things like NavigateTo<TController>() against controllers that are in areas without using the MvcFuture’s ActionLinkAreaAttribute. My thanks go out to Neuhoffm for this improvement!

Passing Data to Angular from ASP.NET MVC Views

Angular is a great tool for enriching an ASP.NET MVC application, but you must bridge the gap between your client-side code and your server-side code in order to use it effectively.  In this post, I’ll show you a couple of ways that you can pass data from your Razor views to your AngularJS components. More...

Random Link Roundup–1/29/2015

Are we really almost 1/12th of the way through 2015?  Where does the time go?!?  More...

Entity Framework, Enums, and TINYINT

Entity Framework supports Enum properties on your model, but there’s one little gotcha that’s bitten me on more than one occasion now.  In your database, you may be tempted to save space by configuring the backing column to use an integer value that takes up less space than a normal int, such as a TINYINT (byte) or SMALLINT (short).  If you do though, you may get an error like the following: System.InvalidOperationException : The 'State' property on 'Issue' could not be set to a 'System.Byte' value. You must set this property to a non-null value of type 'IssueState'. It sounds... [More]

On Occam’s Razor and Refactoring

Continuing on with my ramblings from last time: refactoring is a powerful tool that can help you transition your application (solution) from the complex end of the spectrum towards the simpler end. More...

SpecsFor 4.3.1, SpecsFor<Web> Helpers 1.4.1 released!

I have two bug-fix releases for you tonight.  First, SpecsFor now supports partial matching on List types, including generic lists.  It works exactly the same as an array.  Here are the passing specs to illustrate what you can do now: [Test] public void then_it_does_not_throw_on_a_matching_pair_of_objects() { var obj1 = new TestClass { Name = "Name", Items = new List<NestedClass> { new NestedClass { Id = 1, Name = "One" } } }; Assert.DoesNotThrow(() => obj1.ShouldLookLike(() => new TestClass { Name = "Name", Items... [More]