Testing Only the Code You Write: Isolating Components with Moq

When you're testing an ASP.NET MVC controller (or, really, any class at all) you want to make sure the code that fails is the code you're testing. Moq provides a simple way to isolate the code you're testing and lets you generate test cases.

It's Safe to Handle Unhandled Visual Basic and C# Exceptions

Pile on the exceptions, and .NET will have your back with the tools it provides at your disposal.

Best Practices for Lazy Loading in Entity Framework

Sometimes you want child objects retrieved with the parent object, and sometimes you don't. What you NEVER want is to retrieve child objects accidentally. Here's Peter's advice on how to get the best performance when loading child objects.

Life Without On Error Resume Next

The alternative to that simple error-handling combo is the Try...Catch, but it's not as simple as wrapping up your code with it.

Setting the Order of Your Script Files

Script bundling speeds up your application by reducing the time it takes to download all of your JavaScript code. But you'll need another object to get your files added to the page in the order you want.

Neural Networks Using the R nnet Package

The R language simplifies the creation of neural network classifiers with an add-on that lays all the groundwork.

Organize Your Tests to Reduce Overhead

In test-driven development, you have to decide how you'll divide your test methods between your test classes. The best solution is the one that requires the least effort on your part and implements the Single Responsibility Principle for tests.

Defining Columns, Primary, and Composite Keys in Entity Framework

There are two attributes you can put on your entity class properties: one is a convenience, the other is essential, and both are required when the primary key for a table consists of two columns.

Sez Who? Support for iOS 10 Speech Recognition in Xamarin

With Apple's update to its phone OS, we look at the support that Xamarin has for it by building a simple speech app.

Browsing Objects with IndexedDB

Peter shows how to browse a set of objects in an IndexedDB ObjectStore and, along the way, finishes up his TypeScript/IndexedDB utilities for storing and retrieving large amounts of data on the client.

Debugging Mouse Clicks and Dragging in C++

Debugging mouse events is especially confusing, because when the debugger stops the code, most of the events go away! What tactics can we use in these situations?

SpecFlow Two-Step Parameter Conversions

Here's how to use SpecFlow to convert plain-text scenario steps into .NET types.

Creating HTML Helpers You Can Use in Any ASP.NET View

An HTML Helper is a bit of Razor code that can be called from multiple places in a View. But, if you put your Helper in the right place, you can also use it from any View in your application.

Magic Forms Access in Visual Basic and C#

Look behind the curtain on this one, and you'll see that code is quite magical in and of itself.

The Reality of Getting Started with Test-Driven Development

Moving to TDD with ASP.NET is not, in fact, as easy as everyone tells you it is. But it's not as much work as you might think, either. Here's what you need to do to start doing TDD in the real world with an existing ASP.NET MVC application.

Choosing Between Default Arguments and Overloading in C++

Decisions, decisions. Here's why overloading will keep you out of trouble.

Nesting Layouts in ASP.NET MVC

If you've got a site that contains subsites and want to visually distinguish between those subsites (while still maintaining your site's visual integrity), consider nesting layouts within layouts.

Strategies for Debugging Lots of C++ Objects Effectively

When you have code that is called for many objects it's hard to go through all them and just check line by line. How can you more efficiently debug lots of code?

Extending a Universal Windows Platform Media App

Both the MediaElement and Player Framework provide rich, on-screen elements for controlling media playback. Here's how to use a Universal Windows Platform app to use both the System Media Transport Controls and Cortana to provide an alternative, more integrated player experience.

Use Constants and Enums to Improve Readability (and Reduce Maintenance)

If you're not using Const and Enums then you're just making life harder for the next programmer.

Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.