Embedded Resources

There are 3 entries for the tag Embedded Resources

Extract Embedded Resources With An Attribute In MbUnit

UPDATE: This functionality is now rolled into the latest version of MbUnit. A long time ago Patrick Cauldwell wrote up a technique for managing external files within unit tests by embedding them as resources and unpacking the resources during the unit test. This is a powerful technique for making unit tests self contained. If you look in our unit tests for Subtext, I took this approach to heart, writing several different methods in our UnitTestHelper class for extracting embedded resources. Last night, I had the idea to make the code cleaner and even easier to use by implementing a custom test decorator attribute...

Switching to MbUnit

For the longest time now, I’ve been a fan of MbUnit, but never really used it on a real project. In part, I stuck with NUnit despite MbUnit’s superiority because NUnit was the defacto standard. Well you know what? Pretty much every company or client I end up moving to has not had unit testing in place before I arrived. I’ve always been the one to introduce unit testing. So on my latest project, when I finally meet another developer who writes unit tests, and he is using MbUnit, I decided to make the switch. And that, my friends, was...

Using Embedded Resources for Client Script Blocks in ASP.NET

A while ago Patrick Cauldwell highlighted a wonderful technique of using embedded resources for unit testing with external files. Fully on board with Pat, I’ve applied that technique to client script blocks when building web controls and ASP.NET pages. How often have you written (or had to deal with) crap like this. string script = "<script language=\"javascript\">" + "function SomeFunction(someParam)" + Environment.NewLine + "{" + Environment.NewLine + " alert(’Man, this sucks!’);" + Environment.NewLine + "}" + Environment.NewLine + "</script>"; A preferred approach is to have your client script code in a separate file. For web...