Archive | Lessons RSS feed for this section

Create An X Delimited String From A Char List Using Linq Aggregate

A quick example of how to use the Aggregate method to create a string of delimited members, or in this case characters. You might wonder why this example, or at least you should. It’s true, the character list to delimited string is pretty useless, but some idiot from where I work needed it. [TestMethod] public [...]

Leave a comment Continue Reading →

XUnit and Connection Strings

A real quick one but maybe a good one. I was running the xUnit.gui.exe program to run units tests using xUnit… duh. Problem I ran into is that xUnit is not a part of the solution that the tests were. This caused issues when trying to run integration tests since the needed app.config wouldn’t be [...]

Leave a comment Continue Reading →

Fun with F# and Method Reduction

So the first and second methods came from this book , but I thought for fun I might reduce it further to see how small a call could get. Basically take a number and divide it by another number 3 times. let bytesToGb item = let itemB = item / 1024I let itemC = itemB [...]

Leave a comment Continue Reading →

Unit Testing 4.0 Web Forms Including Event Handlers Like Page_Load Using Dynamic

If you’re too lazy or just plain impatient, you can find the source code here. So one of the biggest pains in a place that doesn’t lend itself well to be in pain has been trying to unit test web forms like how MVC controllers can be. Before 4.0, this was an aggrevation at the [...]

Leave a comment Continue Reading →

Test Driven Development… A Simplified Start

So I went to a “doctor’s appointment” yesterday and was asked to do some pair(ed?) programming to solve a simple-ish request. Basically it was: Get a number in a list of integers that is closest to 0. Sounds easy enough, right? Well there are a few more rules but nothing game breaking: If the list [...]

Leave a comment Continue Reading →